JavaScript the complete guide from beginner + advanced Flashcards
what is javascript?
it is a dynamic , weakly typed programming language that is compiled at runtime
how is javascript executed?
with javascript engine like V8 on chrome or spidermonkey on firefox
what are the steps of the execution of javascript?
1 - parse
2 - compile to machine code
3 - execute machine code
what do we mean by weakly typed?
we don’t have to declare the variable type
what do we mean by dynamic
type of variable can change at run time (code can change at runtime )
what is the difference between ECMAscript and javascript?
javascript is an implementation of ECMAScript like jscript or Actionscript
can u access variables outside the function?
yes functions can access global variables
can u access the variables inside of a function?
no local scopes cannot be accessed from outside the function
can u redecalare the same variable?
no u can only declare it once but u can declare it in global scope and then redeclare it in another local scope
what is shadowing?
creates a new variable on a different scope - this variables does not overwrite or remove the global variable by the way - both co-exist.
why do we use indirect function calls like calling a function without parenthesis?
Sometimes however, you don’t want to execute the function immediately. You rather want to “tell JavaScript” that it should execute a certain function at some point in the future like with an event listener
what is the difference between indirect function call and direct function call?
direct function call executes the function immediately but indirect function call tells java script to just register the function in case we call it in a particular situation
what happens when u call a function without parenthesis in just an empty line?
nothing happens and no error will occur
how to convert from string to int or float?
parseInt and parseFloat