js1_Mock
js1_Mock
1. What is JavaScript ?
JavaScript is a text-based programming language used both on the client-side and server-side that allows you to make web pages
interactive.
2. What is ECMA?
JavaScript is a language based on ECMAScript. A standard for scripting languages like JavaScript, JScript is
ECMAScript.
3. console.log():
/* multiline comments */
5. what is ….
Prompt – used to display a dialogue with an optional message to get user to input some text.
6. what is ..
Global Scope: Global variables can be accessed and modified anywhere in the program
Local Scope: Local variables cannot be accessed outside the function declaration.
7. what is variables?
>variable name can only contain alpha numeric characters and underscores.
8. What is ..
9. what is Operators?
Operators are the symbols which tells the interpreter to do some mathematical / logical operations .
>Arithmatic operators
>Comparison operators
>Logical operators
>Ternary Operators
>Bitwise operators
Ternary operators makes single line the condition becomes true / false.
Boolean – true/false
Object – complex data structure like array . object is a key name and key value pair.
Var : it can be reassign the values . when you want to deal with local / global variables . var has a function scope.
Let: it can be reassign the values . But let using temporary purpose only. let has a block scope
17. loops….
For loop - Which allows code to be executed repeatedly until it react the condition .
Closure reffered to as an inner function having access to the variables in the outer function scope chain.
>Global variable
Hoisting is the default behaviour of moving all the declaration at the top of the scope before code execution.
NAN – it is not a legal number . it indicates a value which is not a legal number .
Function is a set of statements that performs a task , it should take some input and return an output.
Constructor is a function that creates an instants of class ,instant of class is known as object.
Foreach loop is a control flow statement for traversing items in a collection. Foreach is usually used in place of a standard for
loop statement.
Dom stands for Document object model . A Dom represent the HTML document . It can be used to access and change the content
of html.
document.getElementById()
document.getElementsByClass()
document.getElementByTagName()
document.querySelector()
Event Bubbling - child element handled first then execute the parent(false).
Event Capturing – parent element handled first then execute the child(true).
30.What is …
Call() - Call invokes the function and allows you to pass in arguments one by one.
Apply() - apply invokes the function and allows you to pass in arguments as an array
Promises are used to handle asynchronous functions . promises takes two argument resolve and reject..when the function
successfully fulfilled it gets resolve, otherwise it get reject.
Then()- method is used with the callbacks when promises is successfully resolved.
35.what is ….
36.what is ….
Test() - it is a RegExp method . it searches a string for a pattern and returns true / false depending on the result.
HTTP Request – it is used to get data from one server to another server
Fetch API – it is used to get the data from the server and it load new information whenever it needed.
39. what is …
Javascript strict mode is used to generates silent errors. It provides use strict expression to enable the strict mode.
console.log(addAllArgs(6, 5, 7, 99))
console.log(addAllArgs(1, 3, 4))
56.JSON.Stringify vs JSON.parse
method takes a string as input and transforms it into an
JSON.parse()
object. JSON.stringify() takes a JSON object and converts it into a string.