4/7 If statement


var text = "OJ afsJ.";
var myName = "Jevin";
var hits = [];

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


The output is myName variable twice, what is this code doing?


first in the for loop its going through all of the strings in text since it is set toi<text.length (.length finds the length of the string), and in your text there are two J's so it console.log your name twice! Hope this helped and take a look at this


/*jshint multistr:true */
var text = "Mornings are often \ a tough time, right Ron?";
var myName = "Ron";
var hits = [];
//end of global variables
for(var i = 0; i < text.length; i++) {
if (text[i]=== "R") {}}