full stack web developer training n.
Skip this Video
Loading SlideShow in 5 Seconds..
JavaScript Interview Questions and Answers | Full Stack Web Development Training | Edureka PowerPoint Presentation
Download Presentation
JavaScript Interview Questions and Answers | Full Stack Web Development Training | Edureka

Loading in 2 Seconds...

play fullscreen
1 / 61

JavaScript Interview Questions and Answers | Full Stack Web Development Training | Edureka - PowerPoint PPT Presentation


  • 8 Views
  • Uploaded on

( ** Full Stack Web Developer Masters Program: https://www.edureka.co/masters-program/full-stack-developer-training ** )
This Edureka PPT on "JavaScript Interview Questions" will help you to prepare yourself for Java Interviews (JavaScript Interview Questions Blog: https://www.edureka.co/blog/interview-questions/javascript-interview-questions/ ). Learn about the most important JavaScript interview questions and answers and know what will set you apart in the interview process.

Instagram: https://www.instagram.com/edureka_lea...
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
    Presentation Transcript
    full stack web developer training

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    agenda

    Agenda

    History of JavaScript

    Salary Trends

    Companies using JavaScript

    JavaScript beginner interview Questions

    JavaScript intermediate interview Questions

    JavaScript Advance interview Questions

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    history of javascript

    History of JavaScript

    The first version of

    JScript was included

    with Internet Explorer

    3.0, released in August

    1996.

    It was initially named

    as Mocha

    JavaScript was created

    by Brendan Eich in

    1995 during his time at

    Netscape

    Communications.

    With the road full of

    bumps, JavaScript is

    still one of the most

    successful languages

    ever.

    JavaScript was

    conceived of as a

    scripting language for

    both client and server

    side.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript salary trend

    JavaScript Salary Trend

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    companies using javascript

    Companies using JavaScript

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    beginner level

    Beginner level

    01

    Intermediate level

    02

    Advance level

    03

    Copyright © 2018, edureka and/or its affiliates. All rights reserved.

    javascript interview questions

    JavaScript Interview Questions

    01

    What is JavaScript?

    A

    ➢JavaScript is an object-oriented computer programming language commonly used to

    create interactive effects within web browsers.

    ➢It allows you to build into otherwise static HTML pages.

    ➢It language has been embedded in Netscape, Internet Explorer, and other web browsers.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 1

    JavaScript Interview Questions

    02

    What is the difference between Java and JavaScript?

    A

    ➢ Java is a complete programming language whereas JavaScript is

    a coded program that can be introduced to HTML pages.

    ➢ Java is an object - oriented programming (OOPS) or structured

    programming language like C++ or C whereas JavaScript is a

    client-side scripting language.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 2

    JavaScript Interview Questions

    03

    What are the Data Types Supported by JavaScript?

    Object

    Undefined

    Symbol

    Boolean

    Number

    String

    Null

    1

    2

    3

    4

    5

    6

    7

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 3

    JavaScript Interview Questions

    04

    What are the Features of JavaScript?

    Security

    01

    Growth

    02

    Conversion

    03

    Presentation

    04

    Presentation

    05

    It is a lightweight,

    interpreted

    programming

    language.

    It is designed for

    creating network-

    centric

    applications.

    It is

    complementary

    to and integrated

    with Java.

    It is

    complementary

    to and integrated

    with HTML.

    JavaScript is open

    and cross-platform.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 4

    JavaScript Interview Questions

    05

    Is JavaScript a case-sensitive language?

    A

    Yes, JavaScript is a case sensitive language. The

    language keywords, variables, function names, and

    any other identifiers must always be typed with a

    consistent capitalization of letters.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 5

    JavaScript Interview Questions

    06

    What are the advantages of JavaScript?

    Less Server

    Interaction

    Immediate

    feedback to the

    visitors

    Increased

    Interactivity

    Richer Interfaces

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 6

    JavaScript Interview Questions

    07

    How can you create an object in JavaScript?

    A

    JavaScript supports Object

    concept very well.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 7

    JavaScript Interview Questions

    08

    How can you create an Array in JavaScript?

    A

    Arrays can be defined using the

    array literals in the following

    way:

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions javascript

    JavaScript Interview Questions

    JavaScript Interview Questions

    09

    What is a name function in JavaScript & how to define it?

    A

    A named function has a name

    when it is defined. It can be

    defined using function

    keyword as :

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 8

    JavaScript Interview Questions

    Can you assign an anonymous function to a variable and

    pass it as an argument to another function?

    10

    A

    Yes! An anonymous function can be assigned to a variable and also pass it as an

    argument to another function

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 9

    JavaScript Interview Questions

    What is argument objects in JavaScript & how to get the type of

    arguments passed to a function?

    11

    A

    It can be passed using Typeof operator:

    JavaScript variable arguments

    are the arguments passed to

    a function.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 10

    JavaScript Interview Questions

    12

    What are the scopes of a variable in JavaScript?

    A

    The scope of a variable is the region of your program in which it is defined.

    JavaScript variable will have only two scopes.

    • Global Variable- It is visible everywhere in your JavaScript code.

    • Local Variable- It will be visible only within a function where it is defined.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 11

    JavaScript Interview Questions

    13

    What is the purpose of ‘This’ operator in JavaScript ?

    A

    The famous JavaScript keyword ‘this’ refers to the current context.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 12

    JavaScript Interview Questions

    14

    What is Callback?

    A

    A callback is a plain JavaScript function passed to some method as an argument

    or option. Some callbacks are events that are called to give the user a chance to

    react when a certain state is triggered.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 13

    JavaScript Interview Questions

    15

    What is Closure? Give an example

    EXAMPLE:

    A

    Closures are created whenever a

    variable that is defined outside the

    current scope is accessed from within

    some inner scope.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions javascript 1

    JavaScript Interview Questions

    JavaScript Interview Questions

    16

    Built-in methods

    Built-in Methods

    Returns

    01

    01

    CharAt()

    It returns the character at the specified index.

    02

    02

    Concat()

    It returns the character at the specified index.

    03

    03

    forEach()

    It calls a function for each element in the

    array.

    04

    It returns the index within the calling String

    object of the first occurrence of the specified

    value.

    04

    indexOf()

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions javascript 2

    JavaScript Interview Questions

    JavaScript Interview Questions

    16

    Built-in methods

    Built-in Methods

    Returns

    05

    05

    length()

    It returns the length of the string.

    06

    06

    pop()

    It removes the last element from an array and

    returns that element.

    07

    07

    push()

    It adds one or more elements to the end of

    an array and returns the new length of the

    array.

    08

    It reverses the order of the elements of an

    array.

    08

    reverse()

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 14

    JavaScript Interview Questions

    17

    What are the variable naming conventions in JavaScript?

    A

    Rules to Follow while naming variables in JavaScript:

    Do not use any of the JavaScript reserved keyword as variable

    name.

    01

    02

    JavaScript variable names should not start with a numeral (0-9).

    03

    JavaScript variable names are case sensitive.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 15

    JavaScript Interview Questions

    18

    How does TypeOf Operator work?

    A

    The typeof is a unary operator that is placed before its single

    operand, which can be of any type. Its value is a string indicating the

    data type of the operand.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 16

    JavaScript Interview Questions

    19

    How to create a cookie using JavaScript?

    A

    The simplest way to create a cookie is to assign a string value to the

    document.cookie object.

    SYNTAX

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions javascript 3

    JavaScript Interview Questions

    JavaScript Interview Questions

    20

    How to read a cookie using JavaScript?

    A

    ➢ Reading a cookie is just as simple as writing one, because the value of the

    document.cookie object is the cookie.

    ➢ The document.cookie string will keep a list of name = value pairs

    separated by semicolons.

    ➢ You can use strings' split() function to break the string into key and

    values.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions javascript 4

    JavaScript Interview Questions

    JavaScript Interview Questions

    21

    How to delete a cookie using JavaScript?

    A

    If you want to delete a cookie so that subsequent attempts to read the

    cookie return nothing, you just need to set the expiration date to a time in

    the past.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    beginner level 1

    Beginner level

    01

    Intermediate level

    02

    Advance level

    03

    Copyright © 2018, edureka and/or its affiliates. All rights reserved.

    javascript interview questions 17

    JavaScript Interview Questions

    What is the difference between Attributes and Property?

    22

    Attributes

    Property

    Property is the value

    assigned to the property

    like type="text",

    value='Name' etc.

    Attributes provide more

    details on an element

    like id, type, value etc.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 18

    JavaScript Interview Questions

    List out the different ways an HTML element can be accessed in a

    Javascript code.

    23

    getElementById('idname')

    getElementsByClass(‘classname')

    getElementsByTagName(‘tagname')

    querySelector()

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 19

    JavaScript Interview Questions

    24

    In how many ways a JavaScript code can be involved in an HTML file?

    A

    The JavaScript code can be involved in 3 ways:

    01

    03

    Inline

    External

    02

    Internal

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 20

    JavaScript Interview Questions

    25

    What are the ways to define a variable in JavaScript?

    A

    The three possible ways of defining a variable in JavaScript are:

    03

    01

    02

    Const

    let

    Var

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 21

    JavaScript Interview Questions

    26

    What is a Typed language?

    A

    Typed Language is in which the values are associated with values

    and not with variables. There are two types:

    • Dynamically - The variable can hold multiple types.

    • Statically - The variable can hold only one type.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 22

    JavaScript Interview Questions

    27

    What is the difference between Local storage & Session storage?

    A

    Local Storage will stay until it is manually cleared through settings

    or program.

    Whereas Session Storage will leave when the browser is closed.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 23

    JavaScript Interview Questions

    28

    What is the difference between the operators ‘==‘ & ‘===‘?

    A

    The operator '==' compares the value. Whereas, the operator

    '===' compares both value and type.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 24

    JavaScript Interview Questions

    29

    What is the difference between null & undefined?

    A

    When the typeof operator is used on null, the value is an object.

    Whereas, when it is used on undefined, the value would be

    undefined.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 25

    JavaScript Interview Questions

    30

    What is the difference between undeclared & undefined?

    A

    Undeclared variables are those that do not exist in a program and

    are not declared. Undefined variables are those that are declared

    in the program but have not been given any value.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 26

    JavaScript Interview Questions

    31

    Name some of the JavaScript Frameworks

    A

    There are many JavaScript Frameworks available but some of the most

    commonly used frameworks are:

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 27

    JavaScript Interview Questions

    32

    What is the difference between window & document in JavaScript?

    Window

    Document

    The document also comes under

    the window and can be

    considered as the property of

    the window.

    JavaScript window is a global

    object which holds variables,

    functions, history, location.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 28

    JavaScript Interview Questions

    33

    What is the difference between innerHTML & innerText?

    innerHTML

    innerText

    innerText will not process an

    HTML tag if found in a string

    innerHTML will process an HTML

    tag if found in a string

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 29

    JavaScript Interview Questions

    34

    What is an event bubbling in JavaScript?

    A

    When an event is fired on an HTML element, the execution

    starts from that event and goes to its parent element. Then

    the execution passes to its parent element and so on till

    the body element.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 30

    JavaScript Interview Questions

    35

    What is NaN in JavaScript?

    A

    NaN is a short form of Not a Number. When a string or

    something else is being converted into a number and that

    cannot be done, then we get to see NaN.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 31

    JavaScript Interview Questions

    36

    How do JavaScript primitive/object types passed in functions?

    A

    Primitive types in JavaScript are passed by value.

    Whereas, object types are passed by reference.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 32

    JavaScript Interview Questions

    37

    How can you convert the string of any base to integer in JavaScript?

    A

    The parseInt() function is used to convert numbers between different bases. It

    takes the string to be converted as its first parameter, and the second parameter

    is the base of the given string.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 33

    JavaScript Interview Questions

    38

    What would be the result of 2+5+“3"?

    A

    Since 2 and 5 are integers, they will be added numerically. And since 3 is a string,

    its concatenation will be done. So the result would be 73

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 34

    JavaScript Interview Questions

    39

    What are Exports & Imports?

    A

    Imports and exports help us to write modular javascript code. Using Imports and

    exports we can split our code into multiple files.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    beginner level 2

    Beginner level

    01

    Intermediate level

    02

    Advance level

    03

    Copyright © 2018, edureka and/or its affiliates. All rights reserved.

    javascript interview questions 35

    JavaScript Interview Questions

    40

    What is the ‘Strict’ mode in JavaScript and how can it be enabled?

    A

    • Strict mode is a way to introduce better error-checking into your code.

    • When you use strict mode, you cannot use implicitly declared variables, or

    assign a value to a read-only property, or add a property to an object that is

    not extensible.

    • You can enable strict mode by adding “use strict”; at the beginning of a file, a

    program, or a function.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 36

    JavaScript Interview Questions

    41

    What is a prompt box in JavaScript?

    A

    A prompt box is a box which allows the user to enter input by providing a

    text box. Label and box will be provided to enter the text or number.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 37

    JavaScript Interview Questions

    42

    What Will Be The Output Of The Code Below?

    A

    The output would be 1undefined. The if

    condition statement evaluates using

    eval, so eval(function f(){}) returns

    function f(){} (which is true).

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 38

    JavaScript Interview Questions

    43

    What is the difference between Call & Apply?

    The call() method calls a

    function with a given this value

    and arguments provided

    individually.

    The apply() method calls a

    function with a given this value,

    and arguments provided as an

    array.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 39

    JavaScript Interview Questions

    44

    How to empty an Array in JavaScript?

    Above code will set

    the variable arrayList

    to a new empty array

    The code above will clear

    the existing array by

    setting its length to 0.

    Method 1

    Method 2

    This way of emptying

    the array will update

    all the references to

    the original array.

    The implementation

    above can also empty

    arrays but it is not

    recommended

    Method 3

    Method 4

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 40

    JavaScript Interview Questions

    45

    What Will Be The Output Of The Following Code?

    A

    The output would be 0. The delete

    operator is used to delete properties

    from an object.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 41

    JavaScript Interview Questions

    46

    What Will Be The Output Of The Following Code?

    A

    The output would be undefined. The

    delete operator is used to delete the

    property of an object.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 42

    JavaScript Interview Questions

    47

    What Will Be The Output Of The Following Code?

    A

    The output would be xyz. Here,

    emp1 object has company as its

    prototype property.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 43

    JavaScript Interview Questions

    48

    What Will Be The Output Of The Code Below?

    A

    The output would be Reference

    Error. A function definition can have

    only one reference variable as its

    function name.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 44

    JavaScript Interview Questions

    49What is the reason for wrapping the entire content of a JavaScript source file

    in a function book?

    A

    It creates a closure around the entire contents of the file which, perhaps most

    importantly, creates a private namespace and thereby helps avoid potential name

    clashes between different JavaScript modules and libraries.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training

    javascript interview questions 45

    JavaScript Interview Questions

    50

    What are escape characters in JavaScript?

    A

    EXAMPLE:

    Escape characters (Backslash) is

    used when working with special

    characters like single quotes,

    double quotes, apostrophes and

    ampersands. Place backslash

    before the characters to make it

    display.

    FULL STACK WEB DEVELOPER TRAINING

    www.edureka.co/masters-program/full-stack-developer-training