0% found this document useful (0 votes)
4 views

js1_Mock

JavaScript is a versatile programming language used for creating interactive web pages, based on the ECMAScript standard. It includes various features such as data types, variables, operators, functions, and event handling, along with concepts like closures, hoisting, and asynchronous programming. The document also covers advanced topics like promises, callbacks, and the use of the DOM for manipulating HTML elements.

Uploaded by

Vaishnavi Gajula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

js1_Mock

JavaScript is a versatile programming language used for creating interactive web pages, based on the ECMAScript standard. It includes various features such as data types, variables, operators, functions, and event handling, along with concepts like closures, hoisting, and asynchronous programming. The document also covers advanced topics like promises, callbacks, and the use of the DOM for manipulating HTML elements.

Uploaded by

Vaishnavi Gajula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Javascript

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.

It is light weight , cross platform and object oriented programming language.

Every browser has a javascript interpreter.

2. What is ECMA?

ECMA - European Computer Manufacturers Association

JavaScript is a language based on ECMAScript. A standard for scripting languages like JavaScript, JScript is
ECMAScript.

3. console.log():

Console.log() is a function in javascript, which is used to print any kind of variables .

4. comment lines in javascript:

/* multiline comments */

//single line comments

5. what is ….

Type of – is a in-build function to check the data type.

Alert- used to give the alert message.

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?

Variables are containers for storing data values .

>variables must start with letters and underscore characters.

>variable name can only contain alpha numeric characters and underscores.

>variable names are caes-sensitive

8. What is ..

Input -is a in-build function to get data from the user .

Type Conversion – convert to one data type to another data type .

9. what is Operators?

Operators are the symbols which tells the interpreter to do some mathematical / logical operations .

10. Types of Operators ..

>Arithmatic operators
>Comparison operators

>Logical operators

>Ternary Operators

>Bitwise operators

11. what is == and === ?

Both are comparison operators .

== used to compare values .

=== used to compare values and data types

12. what is && and | operators ?

&& and | are logical operators..

&& - if both operands are true then condition becomes true .

| - if any two operands are non-zero then condition becomes true.

13. what is Identity operator?

compare the memory locations of two objects.

14. what is ternary operators?

Ternary operators makes single line the condition becomes true / false.

15. Data types…

1.premitive data types

String – Group of characters

Number – int , float like 1,2 3

Boolean – true/false

Null – variable with no value

Undefined – variable not yet defined

2.Non-premitive data types

Object – complex data structure like array . object is a key name and key value pair.

Array – array allows to store multiple values in single variable.

16. var vs let vs const ….

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

Const : It cannot be reassign the values .

17. loops….

For loop - Which allows code to be executed repeatedly until it react the condition .

While loop – it will keep on executing repeatedly until it becomes false.


18. what is Global variable and local vriable?

Variable declared outside of the function is called global variable .

Variable declared inside of the function is called local variable.

19. What is Closure in javascript ?

Closure reffered to as an inner function having access to the variables in the outer function scope chain.

Closure has access to the 3 scoped variables ….

>variables in own scope

>variables in function scope

>Global variable

20. what is hoisting ?

Hoisting is the default behaviour of moving all the declaration at the top of the scope before code execution.

21. What is NAN?

NAN – it is not a legal number . it indicates a value which is not a legal number .

Type of NAN – it will return a number

How to check NAN value:

By using isNAN() function.

22. What is Function?

Function is a set of statements that performs a task , it should take some input and return an output.

23. what is constructor?

Constructor is a function that creates an instants of class ,instant of class is known as object.

24. What is ForEach()?

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.

25. what is Dom and uses?

Dom stands for Document object model . A Dom represent the HTML document . It can be used to access and change the content
of html.

26. Advantages of DOM…

>interacting with browser

>change css style

>react to user event

>effects like popup

>add , delete , change content

27. How to access HTML elements Using DOM?

using class , id , tag name …

document.getElementById()
document.getElementsByClass()

document.getElementByTagName()

document.querySelector()

28. What is Events?

Events are handled the fucntions.

29. Event Propagation

To define the way of order which the event occurs.

There are two types….

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

Bind() - it creates new function … it always return function

31. what is callback ?

Callback is a function,function passed into another function as an argument.

32. what is promises ?

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.

33. then() vs catch()

Then()- method is used with the callbacks when promises is successfully resolved.

Catch() - methos also used callbacks when promises is failure / rejected

34. what is …..

setTimeout() – it take some time execute the code

setInterval() – it take time to executed repeatedly.

35.what is ….

Async() – Start now finish later in a time , it is going to execute multiple.

Sync() - it executed sequence one by one .

Await() – It wait until the promises executed

36.what is ….

Test() - it is a RegExp method . it searches a string for a pattern and returns true / false depending on the result.

37. What is …..

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.

JSON – JavaScript Object Notation , it is used to interchange the data

38. What is Anonymous Function ?


it is a function that has no name . these function are declared dynamically at a runtime using the function operator instead of the
function declaration .

39. what is …

Push()- used to add one more element to the end of an array.

Unshift() - used to add one more element to the beginning of array.

40.what is javascript ‘strict mode’?

Javascript strict mode is used to generates silent errors. It provides use strict expression to enable the strict mode.

41.what is spread operator?


spread operators where one or more arguments are expected in a function call.
Ex:
let arr=[1,2,3,4,5,5,6]
console.log(...arr)
The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places
where zero or more arguments (for function calls) or elements (for array literals) are expected.
42.what is Destructuring
43.what is some,every,map,filter,reduce?
44.In js why we using ‘this’ key word?
45. local storage vs session storage
46. Is javascript a statically typed or a dynamically typed language?
JavaScript is a dynamically typed language.
In a dynamically typed language, the type of a variable is checked during run-time in contrast to
a statically typed language, where the type of a variable is checked during compile-time.
47. js is single threading or multithreading
48. js is sync funcion or async function?
49. Explain passed by value and passed by reference?
In JavaScript, primitive data types are passed by value and non-primitive data types are
passed by reference.
50. Explain Higher Order Functions in javascript.
Functions that operate on other functions, either by taking them as arguments or by returning
them, are called higher-order functions.
function name(){
return function(){
return 'Besant Technology'
}
}
x=name()
console.log(x())
51. What do you mean by Self Invoking Functions?
a self-invoking expression is automatically invoked (initiated).
If a function expression is followed by (), it will execute automatically.
A function declaration cannot be invoked by itself.
function name(a){
return function(b){
console.log(a+b)
}
}
name(2)(3)
52. use of contructor:
if we want to create multiple objects having similar properties and methods, constructor
functions are used.
53. What is memoization?
Memoization is a form of caching where the return value of a function is cached based on its
parameters. If the parameter of that function is not changed, the cached version of the function
is returned.
memoization, by converting a simple function to a memoized function
53. What is recursion in a programming language?
Recursion is a technique to iterate over an operation by having a function call itself
repeatedly until it arrives at a result.
54.What are arrow functions?
Arrow functions were introduced in the ES6 version of javascript. They provide us with a new
and shorter syntax for declaring functions.
Arrow functions can only be used as a function expression.
55.what is Rest parameter?
Rest parameter ( … ):
Any number of arguments will be converted into an array using the rest parameter.
It also helps in extracting all or some parts of the arguments.
function addAllArgs(...args){
let sumOfArgs = 0;
let i = 0;
while(i < args.length){
sumOfArgs += args[i];
i++;
}
return sumOfArgs;
}

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy