Can anyone see the error here?


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-XEDZA/0/5?curriculum_id=506324b3a7dffd00020bf661


I ve tried to write my own code after deleting the old one and I made a comparing between the old working one and my own code and I dint find any wrong or difference even though it still not working! can any one see the difference !


text="Blah blah blah blah blah blah Ali \
blah blah blah Ball blah blah Eric blah blah \
blah blah blah blah blah Eric";

var searchName="Ball";
var results =[];
for(var i=0 ; i < text.length ;i++);{
    if (text[i]==="B");{
        for (var l=i; l< (searchName.length+i);l++);{
            results.push(text[l]);
            }
        
        }
    
    }
    
if (results.length===0){
    console.log("No results");
    }
    
    else{
        console.log(results);
        }


#2

for(var i=0 ; i < text.length ;i++); // unnecessary semi-colon 
if (text[i]==="B"); // unnecessary semi-colon
for (var l=i; l< (searchName.length+i);l++); // unnecessary semi-colon

adding too much semi-colons, can cause problems


#3

I think I have big problem with this semicolon when i have to use and when i dont ?
Thank you for support


#4

well, that would be a long answer. Thankfully other people wrote it:

http://www.bradoncode.com/blog/2015/08/26/javascript-semi-colon-insertion/


#5

it seems very useful; but still missing one side what senmicolom means it Programming world ? i mean in javascript sure


#6

just continue learning for the moment, no need to dive into very deep waters about semi-colons at this point, i think it will be more confusing then useful


#7

I've found very good @mtf's explanation about semicolon:
https://www.codecademy.com/en/forum_questions/50e13f9179aabe48e500330f


#8

the problem is learning without understanding will confusing me and make me do many mistakes and many post here hahhha !


#9

Thank you denys i will check it out :slight_smile:


#10

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