With the code below, looking at the 2nd paragraph in particular...if var str = "sting equality test..." + strA, why do the 2nd, 3rd lines etc not output that same output plus their own line?
EDIT sorry for not explaining properly - I am actually just wondering why this code (once I have cleaned it up) DOESN'T produce the first line (of the 2nd paragraph) repeated, plus whatever I state in the 2nd and 3rd lines etc. I don't need it to, it's just an exercise, I just don't understand. It seems as though it should
function init()
{
var strA = "Javascript" === "JAVASCRIPT" ;
var strB = "Javascript" === "Javascript" ;
var flt = 7.5 === 7.5 ;
var intA = 8 !== 8 ;
var intB = 24 > 12 ;
var intC = 24 < 12 ;
var intD = 24 <= 24 ;
var str = "String equality test: " + strA ;
str += "<br>String equality test 2: " + strB ;
str += "<br>Float equality test: " ; + strC ;
str += "<br>Integer inequality test: " + intA ;
str += "<br>Greater than test: " + intB ;
str += "<br>Less than test: " + intC ;
str += "<br>Less than/Equal to test: " + intD ;
document.getElementById( "panel" ).innerHTML = str ;
}
document.addEventListener("DOMContentLoaded" , init , false) ;
So the output I get is as follows;
String equality test: false
String equality test 2: true
Float equality test: true
Integer inequality test: false
Greater than test: true
Less than test: false
Less than/Equal to test: true
This is obviously correct, I just don't understand how something like the following isn't outputted because surely I am adding each line to the var str, which is "String equakity test: false
String equality test: false String equality test: false String equality test 2: true String equality test: false Float equality test: true String equality test: false Integer inequality test: false String equality test: false Greater than test: true String equality test: false Less than test: false String equality test: false Less than/Equal to test: true
;in the third line?