Your "If" statement


#1

/*jshint multistr:true */

var text = 'Some text and words Robert and letters and Robert and more and more';

var myName = 'Robert';

var hits = [];

for (var i = 0; i < text.length; i++) {
if (text [i] === 'R') {
}
}

why is it not working?


#2
var text = 'Some text and words Robert and letters and Robert and more and more';

var myName = 'Robert';

var hits = [];

for (var i = 0; i < text.length; i++) {
 if (text [i] === 'R') {
   console.log( text[i]
 }
}