15 JavaScript Developer interview questions and answers

Find and hire talent with confidence. Prepare for your next interview. The right questions can be the difference between a good and great work relationship.

Trusted by


What are the advantages of using JavaScript?

You want a developer who really knows how to play to the strengths of your chosen platform. Some key advantages of JavaScript are listed below for your convenience.

  • Lightweight: JavaScript can be executed within the user’s browser without having to communicate with the server, saving on bandwidth.
  • Versatile: JavaScript supports multiple programming paradigms—object-oriented, imperative, and functional programming and can be used on both front-end and server-side technologies.
  • Sleek Interactivity: Because tasks can be completed within the browser without communicating with the server, JavaScript can create a smooth "desktop-like" experience for the end user.
  • Rich Interfaces: From drag-and-drop blocks to stylized sliders, there are numerous ways that JavaScript can be used to enhance a website’s UI/UX.
  • Prototypal Inheritance: Objects can inherit from other objects, which makes JavaScript so simple, powerful, and great for dynamic applications.

What are the disadvantages of using JavaScript?

Experienced coders won’t just be able to rave about their favorite language’s strengths—they will also be able to talk about its weaknesses. JavaScript’s main weakness is security. Look for answers on how it can be exploited. A secondary weakness is JavaScript’s ubiquity and versatility—it can be a double-edged sword in that there’s a lot of room for programming quirks that can lead to inconsistent performance across different platforms.

Explain the difference between classical inheritance and prototypal inheritance.

The great thing about JavaScript is the ability to do away with the rigid rules of classical inheritance and let objects inherit properties from other objects. - Classical Inheritance: A constructor function instantiates an instance via the "new" keyword. This new instance inherits properties from a parent class. - Prototypal Inheritance: An instance is created by cloning an existing object that serves as a prototype. This instance—often instantiated using a factory function or "Object.create()"—can benefit from selective inheritance from many different objects.

Give an example of a time that you used functional programming in JavaScript.

Functional programming is one of the key paradigms that makes JavaScript stand out from other languages. Look for examples of functional purity, first-class functions, higher-order functions, or using functions as arguments and values. It’s also a good sign if they have past experience working with functional languages like Lisp, Haskell, Erlang, or Clojure.

Give an example of a time when you used Prototypal OO in JavaScript.

Prototypal OO is the other major programming paradigm that really lets JavaScript shine—objects linked to other objects (OLOO). You’re looking for knowledge of when and where to use prototypes, liberal use of "Object.assign()" or mixins, and a solid grasp of concepts like delegation and concatenative inheritance.

What is a RESTful Web Service?

REST stands for Representational State Transfer, an architectural style that has largely been adopted as a best practice for building web and mobile applications. RESTful services are designed to be lightweight, easy to maintain, and scaleable. They are typically based on the HTTP protocol, make explicit use of HTTP methods (GET, POST, PUT, DELETE), are stateless, use intuitive URIs, and transfer XML/JSON data between the server and the client.

Which frameworks are you most familiar with?

You can tell a lot about a programmer from the frameworks they’re familiar with—AngularJS, React, jQuery, Backbone, Aurelia, and Meteor are just some of the more popular ones available. The key here is to make sure the developer you’re engaging has experience with the framework you’ve chosen for your project.

How experienced are you with MEAN?

The MEAN (MongoDB, Express, AngularJS, and Node.js) stack is the most popular open-source JavaScript software stack available for building dynamic web apps—the primary advantage being that you can write both the server-side and client-side halves of the web project entirely in JavaScript. Even if you aren’t intending to use MEAN for your project, you can still learn a lot about the developer when they recount their experiences using JavaScript for different aspects of web development.

Explain the differences between one-way data flow and two-way data binding.

This question may seem self-explanatory, but what you’re looking for is a developer who can demonstrate solid understanding of how data flows throughout the application. In two-way data binding, changes to the UI and changes to the model occur asynchronously—a change on one end is reflected on the other. In one-way data binding, data only flows one way, and any changes that the user makes to the view will not be reflected in the model until the two are synced. Angular makes implementing two-way binding a snap, whereas React would be your framework of choice for deterministic one-way data flow.

Determine the output of the code below. Explain your answer.

console.log(0.1 + 0.2);
console.log(0.4 + 0.1 == 0.5);

This is a trick question in that at first glance, you might expect the console to print out "0.3" and "true." The correct answer is that you can’t know for sure, because of how JavaScript treats floating point values. In fact, in the above example, it will print out:

0.30000000000000004
false

Determine the output of the code below. Explain your answer.

var myObject = {
  egg: "plant",
  func: function() {
    var self = this;
    console.log("outer func: this.egg = " + this.egg);
    console.log("outer func: self.egg = " + self.egg);
    (function() {
      console.log("inner func: this.egg = " + this.egg);
      console.log("inner func: self.egg = " + self.egg);
    }());
  }
};
myObject.func();

This question is designed to test the interviewee’s understanding of scope and the "this" keyword. In the outer function, both "this" and "self" correctly refer to "myObject" and can subsequently access "egg." In the inner function, "self" remains within scope while "this" can no longer refer to "myObject"—resulting in the output below:

outer func:  this.egg = plant
outer func:  self.egg = plant
inner func:  this.egg = undefined
inner func:  self.egg = plant

Write a function that can determine whether a string is a palindrome in under 100 characters.

A palindrome is a word, phrase, or sequence of letters that reads the same backwards or forwards. It also makes a great test for checking their ability to handle strings.

function isPalindrome(str) {
  str = str.replace(/s/g, '').toLowerCase();
  return (str == str.split('').reverse().join(''));
}

How would you empty the array below?

var emptyArray = [‘this’, ‘array’, ‘is’, ‘full’];

This deceptively simple question is designed to test your prospective coder’s awareness of mitigating potential bugs when solving problems. The easiest method would be to set "emptyArray" equal to "[ ]"—which creates a new empty array. However, if the array is referenced anywhere else, the original array will remain unchanged. A more robust method would be "emptyArray.length - 0;"—which not only clears the array but updates all reference variables that point to this original array. Some possible solutions are listed below:

emptyArray.length = 0;


emptyArray.splice(0, emptyArray.length);


while(emptyArray.length) {
  emptyArray.pop();
}


emptyArray = []

Determine the output of the code below. Explain your answer.

var lorem = { ipsum : 1};
var output = (function() {
  delete lorem.ipsum;
  return lorem.ipsum;
})();

console.log(output);

The output would be undefined, because the delete operator removed the property "ipsum" from the object "lorem" before the object was returned. When you reference a deleted property, the result is undefined.

Are you a team player? Give an example of a time when you had to resolve a conflict with another member on your team.

There are many jobs associated with putting together an application, and chances are high that your new JavaScript developer will at the very least have to interface with a designer. You’re looking for a developer who can communicate effectively when they need to, responds to emails, and knows how to coordinate with other branches of a project.

ar_FreelancerAvatar_altText_292
ar_FreelancerAvatar_altText_292
ar_FreelancerAvatar_altText_292

4.8/5

Rating is 4.8 out of 5.

clients rate JavaScript Developers based on 100K+ reviews

Hire JavaScript Developers

JavaScript Developers you can meet on Upwork

  • $45 hourly
    Shun Kong Y.
    • 5.0
    • (9 jobs)
    Solihull, ENGLAND
    Featured Skill JavaScript
    Amazon Vendor Central
    SAP BASIS
    SAP ERP
    XSLT
    SAP Business Objects
    OAuth
    Apache Cordova
    OpenUI5
    Microsoft Visual C++
    RESTful API
    XML
    SAP HANA
    Transact-SQL
    C#
    Recently helped client: - Tested EDI processing with simulated inbound XML message - Updated formula in Crystal Report printout - Automated data loading to legacy 3rd party application using Power Automate - Verified data records using Power Query / Excel / MSSQL - Transformed Onix 3.0 XML using Excel, VBA and XSLT - Built POC on activating OAuth2 mechanism for SAP API - Deciphered legacy ABAP programs - Pinpointed performance bottleneck Calc. View - Reduced MySQL query to sub-second Skill Possessed: - Programming: .NET, C#, Visual Basic, C++, Excel VBA, Java - Web: XML, XSLT, HTML, CSS, Javascript, oAuth, oData, OpenUI5, Apache Cordova - BI & Database: Power BI, Power Query (M), MSSQL, T-SQL, SAP HANA (Attribute/Analytic/Calculation Views), MySQL - SAP: ERP (FI / CO / SD / MM / PP / PS), BASIS, BO - ABAP: Report, SAPScript, Smart Scripts, BAPI, User Exits, LSMW, IDoc
  • $35 hourly
    Eyamin H.
    • 5.0
    • (202 jobs)
    Magura, DHAKA
    Featured Skill JavaScript
    WooCommerce
    Squarespace
    PHP
    MySQL Programming
    Elementor
    WordPress Plugin
    CMS Development
    Theme Development
    PSD to HTML
    WordPress
    Blog
    HTML5
    CSS 3
    Bootstrap
    jQuery
    Hi. Thank you so much for coming here. I'm WordPress developer. I have been working with WordPress last 10 years. I have developed a wide range web development project. Experience ================= *** html5 , css , css3 , sass , bootstrap , Custom Responsive , JavaScript , jQuery , jQuery Ui , Ajax , Gulp Automation , php , WordPress , WordPress Theme And Plugin Development , Git , Bit-bucket , GitHub ****** #Squarespace Website Builder is my new crush. :) Provide Services =============== ** Full Functionality WordPress theme development with Woo-commerce Support. ** Custom WordPress Plugin Development ** Psd to WordPress. ** Pixel Perfect WordPress Website using page Builder. * Elementor Builder * Divi Builder * Visual Composer * SiteOrigin * Beaver Builder * Fushion Builder ** WordPress Theme Customization any kind of theme. ** Woo-commerce for eCommerce website . * Have Very good knowledge about product feature and attribute ** Psd to html. ** Psd to html with Bootstrap. ** Any Kind of WordPress problem. ** 100% responsive Website. ** Any kind of JQuery, JavaScript Problem. ** Site page Speed. (gtmetrix) , )( Google PageSpeed Insights). My aim is to give you back your project within your right time. and to work in a standard way where clients will be "SATISFIED" of my work .
  • $35 hourly
    Muhammad N.
    • 5.0
    • (22 jobs)
    Ali Pur Chattah, PUNJAB
    Featured Skill JavaScript
    Redux
    Flask
    Node.js
    Social Media Account Integration
    HTML5
    React
    TypeScript
    iOS
    Android
    GraphQL
    MongoDB
    React Native
    Python
    💎 Upwork Top-Rated Developer 💎 💰I'll give life to your ideas 💰 Full-stack software developer with 5 years of experience specializing in designing and developing custom websites and large-scale applications with a focus on client satisfaction. I am well equipped in following skills: - React - Material-UI - Materialize-CSS - React Native - Native Base - MongoDB - MySQL - Alchemy - Postgres SQL - Firebase - GraphQL - Python - Flask - Web Scrapping Server/Backend Development: I can write backend or your mobile with secure management. It will be restfull so you can use it anywhere for web and mobile. I will write secure backend in flask with graphql. We will use Attribute-based Access Control(ABAC) and Graph-based Access Control(GBAC) for authorization and prevent from malicious users. Web and Mobile App Development: Looking to build Hybrid App using React Native ? If yes, please feel free to connect with me as I have exemplary skills and experience in building highly scalable and robust cross platform mobile apps using react native and firebase. My Services & Expertise: - UI/UX improvements. - Bug fixing in existing app. - Design improvements. - API integration. - Camera, Audio/Video features. - Server API development to use it with app. - Cross Device support - Firebase integration. - Push Notifications. - Social Logins. - Location based app. - Maps integration. DEVELOPMENT PROCESS Collect & Analyze Client Requirements Wireframing App Flow Design Development Maintenance & Support Looking forward to hearing your idea and/or business needs and help you build it!
Want to browse more talent? Sign up

Join the world’s work marketplace

Find Talent

Post a job to interview and hire great talent.

Hire Talent
Find Work

Find work you love with like-minded clients.

Find Work