reenadak

2019-05-11_JavaScript_tips

May 11th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This is single line JavaScript comment
  2.  
  3. /* This is multi line
  4.  JavaScript comment */
  5.  
  6. // defining variable
  7. var fullname;
  8.  
  9. // getting input
  10. fullname = prompt("What is your full name.");
  11.  
  12. // Three method of defining array.
  13. var countries = ["India", "Russia", "China"];
  14. var countries = Array("India", "Russia", "China");
  15. var countries = new Array("India", "Russia", "China");
  16.  
  17. // There is a fourth way also.
  18. var countries = [];
  19. countries.push("India");
  20. countries.push("Russia");
  21. countries.push("China");
Advertisement
Add Comment
Please, Sign In to add comment