1 / 61

JavaScript Interview Questions and Answers | Full Stack Web Development Training | Edureka

( ** Full Stack Web Developer Masters Program: https://www.edureka.co/masters-program/full-stack-developer-training ** ) <br>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. <br><br>Instagram: https://www.instagram.com/edureka_lea... <br>Facebook: https://www.facebook.com/edurekaIN/ <br>Twitter: https://twitter.com/edurekain <br>LinkedIn: https://www.linkedin.com/company/edureka

EdurekaIN
Download Presentation

JavaScript Interview Questions and Answers | Full Stack Web Development Training | Edureka

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FULL STACK WEB DEVELOPER TRAINING www.edureka.co/masters-program/full-stack-developer-training

  2. 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

  3. 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

  4. JavaScript Salary Trend FULL STACK WEB DEVELOPER TRAINING www.edureka.co/masters-program/full-stack-developer-training

  5. Companies using JavaScript FULL STACK WEB DEVELOPER TRAINING www.edureka.co/masters-program/full-stack-developer-training

  6. Beginner level 01 Intermediate level 02 Advance level 03 Copyright © 2018, edureka and/or its affiliates. All rights reserved.

  7. 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

  8. 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

  9. 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

  10. 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

  11. 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

  12. 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

  13. 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

  14. 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

  15. 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

  16. 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

  17. 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

  18. 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

  19. 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

  20. 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

  21. 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

  22. 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

  23. 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

  24. 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

  25. 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

  26. 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

  27. 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

  28. 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

  29. Beginner level 01 Intermediate level 02 Advance level 03 Copyright © 2018, edureka and/or its affiliates. All rights reserved.

  30. 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

  31. 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

  32. 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

  33. 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

  34. 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

  35. 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

  36. 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

  37. 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

  38. 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

  39. 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

  40. 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

  41. 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

  42. 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

  43. 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

  44. 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

  45. 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

  46. 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

  47. 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

  48. Beginner level 01 Intermediate level 02 Advance level 03 Copyright © 2018, edureka and/or its affiliates. All rights reserved.

  49. 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

  50. 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

More Related