Interview Questions on Java Script
11. How to append the content to particular div element?
document.getElementById(‘#idname).innerHTML += ‘html code goes here’ ;
13. How to declare and initialize variables?
Syntax :- var van_name = value; Ex:- var var1 = 5;
By using + Ex:- var var = “string1”+”string2”; Ex 2:- var var1 = ”string1”; var var2 = “string2”; var var3 = var1 + var2;
Method1 :- // comments goes here Method2 :- /* comments goes here */
16. What are the rule to write an identifier?
18. What are the ways to write multiple words as variablename?
1. Use _ b/w words. 2. Use camelcase(capital letter for every first letter).
var,if, while,for, break,continue,function,new
20. How to convert string to number?