0% found this document useful (0 votes)
7 views36 pages

2 Javascript Question

The document is a comprehensive guide on JavaScript interview questions, covering various topics such as JavaScript fundamentals, code implementation, theoretical questions, and practical coding challenges. It emphasizes the importance of understanding JavaScript for web development careers and provides insights into common interview queries. The content is structured to help candidates prepare effectively for job interviews in the field of web development.

Uploaded by

NITESH RAGHUNATH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
7 views36 pages

2 Javascript Question

The document is a comprehensive guide on JavaScript interview questions, covering various topics such as JavaScript fundamentals, code implementation, theoretical questions, and practical coding challenges. It emphasizes the importance of understanding JavaScript for web development careers and provides insights into common interview queries. The content is structured to help candidates prepare effectively for job interviews in the field of web development.

Uploaded by

NITESH RAGHUNATH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 36
JAVASCRIPT Terr = IN] cK WE uv _ TI Sey mY 5 w itv | 7 ‘1 Ff ih iv AND ANVIL Boosting your Web Development Career “IS id le] = | JavaScript Interview Questions JavaScript Interview Questions JavaScript Interview Questions Contents 13 What is Javascript? . Javascript Code Implementation. 1.2.1 Implementing Javaserpt 1.2.2 Writing Javascript 1.23 Objects Javascript Events 2 Theoretical Questions 24 22 23 24 25 26 27 28 29 210 2a 212 Can you name two programming paradigms important for JavaScript app developers? What is functional programming? What is the rence between classical inheritance and prototypal inheritance? ‘When is prototypal inheritance an appropriate choice? ‘What is asynchronous programming, and why i it important in JavaScript? What are JavaScript datatypes? What isthe difference between "==" and What is an undefined value in JavaScript? What are the different types of errors in JavaScript? « Define event bubbling What isthe significance, and what are the benefits, of including use strict at the beginning of a JavaScript source file? ‘What are Sereen objects? 3 Code Output Questions 34 35 ‘What will the code below output to the console and why? 3.1 Answer: ‘What will the code below output tothe console and why’? ‘What will the code below output? Explain your answer. Consider the following code snippet: 34.1 Answer ‘What will the code below output to the console and why? 10 ul JavaScript Interview Questions 3.5.1 Answer: 3.6 The following recursive code will cause a stack overflow if the array list is too large. How can you fix this and. still retain the recursive pattern? . 3.6.1 Answer 3.7 What will the code below output to the console and why? ... 3.7.1 Answer: 3.8 What will be the output when the following code is executed? Explain. 3.8.1 Answer ‘Write Code Questions 4.1 What wall the code below output to the console and why? 4.1 Answer 4.2 Write a sum method which will work properly when invoked using either syntax below. 4.3 Write a simple function (less than 80 characters) that returns a boolean indicating whether or not a string is a palindrome, 44 Functional Javascript 4.4.1 Given the following array, build me an array of cars with those colours: 441.1 Answer: . 45° Dynamic Objects . . 4.5.1 T've created an array of 1000 cars. When I call run on the first ear, want it to run as normal, When I call run on any of the others and any cars created in the future, I want it to run as normal, but also log The ccolor car is now running to the console, 45.11 Answer: 4.6 Binding Shim 4.6.1 Can you shim the "bind” function? . . 46.1.1 Answer: . 47 Animation . 47.1 How could you implement moveLeft animation? 4711 Answers. 48 Memorization 4.8.1 How could you implement cache to save calculation time for a recursive fibonacci function? 48.1.1 Answer: 4.8.2 How could you cache execution of any function?” 48.2.1 Answer: . 4.83 How could you set a prefix before everything you log? for example, if you log(my message) it will log: (app) my message”? 483.1 Answer: . n " Mm 2 2 1B 1B 4 4 4 4 15, 15 15 15 15, 1s 1s 16 16 16 16 16 16 16 16 16 7 7 7 7 JavaScript Interview Questions wv 5 Rapid Fire - Tricky Questions 18 sls, om false? 18 52 Is”? false? 7 18 53 Is | earn tase! 18 SA Whatis2+ true? . . 18 55 What is 649? 18 5.6 What isthe value of +New Page 7.9 Explain the role of deferred scripts in JavaScript? By default, the parsing of the HTML code, during page loading, is paused until the script has not stopped executing. It means, if the server is slow or the script is particularly heavy, then the webpage is displayed with a delay. While using Deferred, scripts delays execution of the script till the time HTML parser is running. This reduces the loading time of web pages and they get displayed faster. 7.10 How can a particular frame be targeted, from a hyperlink, in JavaScript? inner#TML content is refreshed every time and thus is slower. There is no scope for validation in innerHTML and, therefore, itis easier to insert rouge code in the document and, thus, make the web page unstable. 7.11 What does a timer do and how would you implement one? ‘Setting timers allows you to execute your code at predefined times or intervals. This can be achieved through two main methods: setInterval (); and setTimeout () ; set Interval () accepts a function and a specified number of milliseconds, ex) set Interval (function () {alert ("Hello, World!"), 10000) will alert the "Hello, World!" function every 10 seconds, set Timeout () also accepts a function, followed by milliseconds, set Timeout () will only execute the function ‘once after the specified amount of time, and will not reoccur in intervals. JavaScript Interview Questions 27/28 7.12 Explain the concept of unobtrusive Javascript? Unobtrusive JavaScript is basically a JavaScript methodology that secks to overcome browser inconsistencies by separating page functionality from structure. The basic premise of unobtrusive JavaScript is that page functionality should be maintained even ‘when JavaScript is unavailable on a user's browser, 7.13, What is "event delegation" and how does it work? Event delegation makes use of two often overlooked features of JavaScript events: event bubbling and the target element. ‘When an event is triggered on an element, for example a mouse click on a button, the same event is also triggered on all of that clement’s ancestors. This process is known as event bubbling; the event bubbles up fom the originating element to the top of the DOM tree. The target element of any event is the originating element, the button in our example, and is stored in a property of the event object. Using event delegation it’s possible to add an event handler to an element, wait for an event to bubble up from a child element and easily determine from which element the event originated 7.14 What is the importance of tag? + JavaScript is used inside tag in HTML document. The tags that are provided the necessary information ike alert t0 the browser for the program to begin interpreting all the text between the tags. + The tag uses JavaScript interpreter to handle the libraries that are written or the code of the program. + JavaScript is a case sensitive language and the tags are used to tell the browser that if itis JavaScript enabled to use the text ‘written in between the tags. 7.15 What is the difference between window.onload and onDocumentReady? ‘The window. onload event won't tigger until every single element on the page has been fully loaded, including images and CSS. The downside to this is it might take a while before any code is actually executed. You can use onDocumentReady to execute code as soon as the DOM is loaded instead, JavaScript Interview Questions 28/28 Chapter 8 A Final Note hope this list serves you as a refresher for what you already know about Javascript. Aside from being able to discuss the topics listed above, you should also be prepared to create whiteboard examples for each one. If you're a pro and use JavaScript everyday, you'll breeze through these. However, what remains of a great importance is having the concentration to listen carefully and use your knowledge/experience alongside with logic to answer any question. The idea of the interview sometimes is not the actual programming language, but 1 identify ifthe candidate is able to solve real life problems on the spot. Fallew Orsifdiquicshy

You might also like