Issuu on Google+

@Javascript_easy    Faire le point      We’ve seen previously the following code    var number_1 , number_2 , result ;  number_1 = prompt (“ type your first number :”);  number_2 = prompt (“type your second number :”);  result = parseInt(number_1) + parseInt(number_2);  alert (result) ;    ok , so number_1 and number_2 were type string ( because of prompt) , the function parseInt() transform them into number , so that’s why alert(result) showed the addition of number_1 and number_2 .

How can we transform numbers into text ? here the following code var number_1 = 6 , number_2 = 6 , number_3 = 6, text ;  text = number_1 + ‘’ + number_2 + ‘’ number_3 ;  alert (text) ;      What the hell is ‘’ ?    a)Empty string b) two quotes what does alert (text) will display ? a) 666 b) 18 whats was the role of empty string ? a) transform with concatenation numbers into string b) the empty



String into numbers