Can anyone see the error here?


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++);{
if (results.length===0){
    console.log("No results");


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


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


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


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


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


I've found very good @mtf's explanation about semicolon:


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


Thank you denys i will check it out :slight_smile:


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