Advertisement
firoze

JavaScript quick info basic

Apr 6th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. //JavaScript quick info basic
  2. console.log(); <!-- Only For Developer Mode -->
  3.  
  4. window.document.write();
  5.  
  6. document.write();
  7.  
  8. window.confirm();
  9.  
  10. confirm();
  11.  
  12. window.alert();
  13.  
  14. alert();
  15.  
  16.  
  17. window.document.getElementById();
  18.  
  19. document.getElementById();
  20.  
  21. window.document.getElementById("id here").innerHTML = value;
  22.  
  23. document.getElementById("demo").innerHTML = "Paragraph changed.";
  24.  
  25.  
  26. <!-- Long Distance traverse -->
  27. innerHTML
  28.  
  29. tagName
  30.  
  31.  
  32. console.log(contentDiv.innerHTML);
  33. document.write(contentDiv.tagName);
  34.  
  35. prompt('Please Input Data'); // this same <input /> and will display popup
  36.  
  37. window.prompt('insert text'); //this same <input/> and will display popup
  38.  
  39. parseInt // here parseInt has been used indicate to integer (as a number)
  40.  
  41. addEventListener // usage like btnChangeText.addEventListener('click',name of function,false);
  42.  
  43.  
  44. <!-- using array literal in JavaScript -->
  45. var array_number = [1,2,3,4,5,6,7,8,9,'Hello World!']; // array literal
  46. window.document.write(array_number[0]); // when will go out of the range then will show undefine
  47.  
  48. length
  49. window.document.write(array_number.length);
  50.  
  51.  
  52. There are 2 types of literal . 1 is array literal and 2 is object literal
  53.  
  54.  
  55. <!-- The Below Example Is json Formate where will stay [] and data will do into it as an object literal-->
  56. [
  57. {name: 'Afghanistan', code: 'AF'},
  58. {name: 'Ă…land Islands', code: 'AX'},
  59. {name: 'Albania', code: 'AL'}
  60. ]
  61.  
  62. <!-- -->
  63. <script>
  64. // window.name = Firstname LastName;
  65.  
  66. // var name = 'H T';
  67.  
  68. name = 'another H T';
  69.  
  70. // this.alert(this);
  71.  
  72. // window.alert(this);
  73.  
  74. // window.confirm('Are you sure?');
  75.  
  76. // window.document.write('Hellow World');
  77.  
  78. // window.document.writeln('Hello World');
  79.  
  80. // console.log('hello');
  81.  
  82. // this.console.log('hello');
  83.  
  84. // alert(name);
  85.  
  86. // this.console.log(window.name);
  87.  
  88. /*
  89. null is object
  90. true or false boolean
  91. 1,2....etc like this is number
  92. anything in '' or "" that are string
  93. like this 555555555555555*'abc' is NaN but a number
  94. */
  95.  
  96. var what_type = 555555555555555*'abc';
  97.  
  98. console.log(what_type);
  99. console.log(typeof what_type);
  100.  
  101.  
  102. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement