Menu
I am new in JavaScript and I cannot understand some code given below .Can anyone explain Line 3 and Line 4 ?
var text = prompt(“What is this ?”);
var firstChar = text.indexOf(“World War II”);
if (firstChar !== -1) {
text = text.slice(0, firstChar) + “the Second World War” + text.slice(firstChar + 12);
}
alert (text);