//js the language
//basics
//inbuilt features
//variables constants
//compilers and interpreters
//window
//types
//conditional
//loops
//functions
//arrays
//objects
//intermediate stuff:-
//prototypes
//prototypal inheritance
//async vs sync
//es6 climax
//questions
//miscellaneous - switch case, ternary op, do-while, for-in, for-of
//interview prep
1.
//js = language
//designed by Brendan Eich in 10 days
//managed by ECMA Script (ES) community. - they add new features, fix bad features, and are
responsible for overall development of js.
//2 major version of js - es5 and es6. (note:there are versions of js before es5 and after es6)
//there are many diff b/w es5 and es6. for example:
//es5 and before = var
//es6 and after = let and const
//in js, we can write both es5 code (var) and es6 code(let &const) and both will work as browser has
both es5 and es6 in it. (js code runs in browser)
//js the language = learn to write code and main features which we must know
//js the dom = learn to make things by writing code.
2.
//basics - connecting the file and loading the script, basics of code execution, grammar and
understanding of errors.
//basics of execution – in js, code is executed line by line.
//grammar & understanding of errors –
In English language, the sentences we speak must be meaningful and follow its grammar(the rules
and regulations for English language).
If it is not followed by someone, then we can’t understand the English spoken by that someone.
Similarly, in any programming language, we must follow the rules and regulations of the language
(called as syntax). In js, if we don’t follow its syntax, then error will come at the line where the syntax
is not followed and the error details will be shown in the console.
For eg:
// error displayed at console: Unexpected identifier ‘a’ @ [Link] file – line 40
(this particular error has occurred at this particular file at this particular line)
This is how we can understand the error displayed at console. And then we can go to that line in our
file and fix the error.
=>
=>after errors are fixed, now no errors are displayed in the console.
3.
//inbuilt features: console, alert and prompt
//these features are provided by browsers to JS.
//[Link] - log(),warn(),error()
//[Link]() => used to print something on the console.
Eg:
=>
//[Link]() => used to print something as warning on console.
Eg:
=> hello printed on console as warning(yellow color triangle = warning)
//[Link]() => used to print something as error on console.
Eg:
=>
//hello printed on console as an error.(red circle with x = error)
//2. alert() - prints something as alert on pop-up box in browser.
//alert's pop-up box is called alert box
Eg:
=>
=>alert box
//[Link]() => used to prompt something to the user and take input from the user
//prompt = alert + one extra features(takes input from user)
//pop-up box of prompt is called prompt box.
Eg:
-prompt box
The input entered by the user can be saved in a variable and used later in js.
For eg:
=>