-
- if, switch, loop statements is JS.
- falsy value in JS.
- undefined, null, 0, NaN, falsy value.
- anonymous function (IMP)
-
- change the content of HTML (innerHTML)
- change the style of elements
- can hide / show the element on condition
-
- in html document inside
<script> </script>
- external
.js
file - NOTE: use
<script>
at the end of html doc.(i.e. before closingbody
tag)
- in html document inside
-
- window.alert()
- document.write()
- document.print() : to print current page
- console.log()
- console.warn() : to specify warning msg
- console.error() : to specify error msg
-
- number(int/float), string(char/string), object(array/object)
- exponential declaration
typeof
method- declaration without initialization considered as
undefined
-
type of ways to access object:
- direct access
- by assingning to other variable by new keyword
- by object constructor
-
basic functions for dom element
- function on button click
onclick
- function to manipulate innerHTML
- function on button click
-
- multiple DataTypes in single array
- add / remove(pop) element
- NOTE: array methods are not covered here!
-
use browser console to run those all methods of 2 and tricks of 3.
-
-
Variable declaration:
- let: block scope, modifiable
- const: gloabl scope, unmodifiable
- var: global scope, modifiable (use rarely)
-
Templete litarals (template string)
-
for .. in and for .. of loops
-
Array methods
-
String methods
-
Date and Time methods
imp
-
Math object
-
-
ES7:
array.includes(ele)
and exponantial oparator2**3
-
ES8:
string.padStart(int)
&string.padStart(int)
andobj.values()
&obj.entries()
ES9: Spread Operator -
ES10:
array.flat(1 to Infinity0)
Multidimension to single dimension array
-
- inline events: alert, confirm.
- custom functions: onclick, onchange, onkeypress, onkeyup, onkeydown, onmousedown, etc.
- getElementById / querySelector obj.onclick:
const usingId = document.getElementById("id"); usingId.onClick = () => {}; usingId.onChange = () => {}; ...
- using event litener
obj.addEventListener('evenType', callback)
recommended
-
Event listeners and event object:
- mouse events: mousedown, mouseup, mouseenter, mouseleave
- key evenets: keypress, keyup, keydown
- querySelector() and addEventListener()
-
- object with stirng, number & function type values.
- ways to specify functoin inside object
- object inside object (nested object)
-
const arr1 = [4,5,6]; const arr2 = [1,2,3,...arr1,7,8,9];
-
- inner block can acquire variable of outer block but dont possible vice versa! this is lexicon scope
-
JSON:
JSON.stringify()
andJSON.parse()
methods
note: go to step by step as given below:
-
- bubbling propagation: bottom-up, by default
- capturing propagation: top-down, set
addEventListener
's third parameter to true
-
Random jokes api implementation:
- concepts: promises, async-await, fetch api
-
- concepts: promises, async-await, fetch api