How to find my name exactly?


How to find my name exactly?

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>

var text =" jiwejhfafhsdf \ jsadhfiuhjsdhfsdfhsaduihwkhsf   haoyihuahjkashdfi\ ughajgnfiuaehgjksdf\ giqnwerguhsfd\ j kghirughsjfdg \ hufgbuqiehrgkajhgwuri\ eghasjhgfqiwuklh\ fgdjsmhvbiuhaoyihuaqerhgfk,sdjghilkwerhb\ iulkbdfilghbsldifughiulw\ erhgiluhwebriulghbnfdghgiauhui";
var myName="haoyihua";
var hits=[];
for(var i=0; i<text.length; i++){
        for(var j=i; j<i+myName.length; j++){
if (hits.length===0)
    console.log( "Your name wasn't found!");
} else{


That is exactly what programming is about, being able to think of a solution. Once you have the correct way to solve the problem, coding is the easy bit

So to maximize learning effect, tell me, how do you think this problem can be solved? To only find an exact match?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.