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

  • $40 hourly
    Shun Kong Y.
    JavaScript Developer
    • 5.0
    • (5 jobs)
    Yuen Long, NYL
    vsuc_fltilesrefresh_TrophyIcon XML
    RESTful API
    Microsoft Visual C++
    OpenUI5
    Apache Cordova
    OAuth
    SAP Business Objects
    XSLT
    SAP ERP
    SAP BASIS
    Amazon Vendor Central
    C#
    Transact-SQL
    SAP HANA
    JavaScript
    Recently helped client: - Automated data loading to legacy 3rd party application using Power Automate - Verified data records using Power Query - 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: - SAP: ERP (FI / CO / SD / MM / PP / PS), BASIS, BO - ABAP: Report, SAPScript, Smart Scripts, BAPI, User Exits, LSMW, IDoc - Web: HTML, Javascript, oAuth, oData, OpenUI5, XML, Apache Cordova - Database: MySQL, MSSQL, T-SQL, SAP HANA (Attribute/Analytic/Calculation Views) - Programming: Java, C#, Visual Basic, C++, Excel VBA
  • $35 hourly
    Santosh Kumar P.
    JavaScript Developer
    • 5.0
    • (81 jobs)
    Lucknow, UTTAR PRADESH
    vsuc_fltilesrefresh_TrophyIcon Magento
    PHP
    JavaScript
    Magento 2
    Yii
    Linux System Administration
    Magento 2
    MySQL
    AWS Lambda
    Website Development
    SaaS
    MongoDB
    Git
    API Integration
    I have developed many sites from scratch using PHP and MySQL. And Have proven 8+ years of experience in this field My major skill is Magento and Magento2 Core skills are Extension and Plugin development [CMS]- Magento I have completed more than 50 extensions of Magento. Some examples: - reward system - payment methods - rental system - pos - Dynamic lightbox - address validator etc. My Magento skill set magento theme magento Theme Development And Design manipulation magneto newsletter magento version upgrade magento product import magento payment integration magento shipping method magento cms magento block magento category magento custom attribute magento frontend magento slideshow magento jquery magento Speed Optimization Design Experience Ui Design Responsive Web Design Theme Customization Website redesign Additional knowledge: jquery javascript php css3 html5 etc.
  • $50 hourly
    Ali A.
    JavaScript Developer
    • 5.0
    • (3 jobs)
    Gulberg, SINDH
    vsuc_fltilesrefresh_TrophyIcon Database Design
    API
    Web Services Development
    MySQL
    HTML
    Ruby on Rails
    Amazon Web Services
    RSpec
    JavaScript
    AngularJS
    Web Development
    PostgreSQL
    Ruby
    I've studied computer science. I have an experience of Web Development with the flavor of HTML, CSS, Bootstrap, JavaScript and other web development tools. I really enjoy this fact that thousands of users use applications that are developed by me. The ultimate dream is that one-day thousands will grow into millions or billions. I HAVE A DREAM! Overall if summarized my experience that would be exploring, organizing information, problem-solving and implementation. Languages are essential for expressing your programming skills overall. From EXPLORING attribute I have worked around lots of different languages. 1) Ruby 2) AngularJS 3) Javascript 4) Python ( a new sensation I always wanted to explore Erlang but then I found this beauty. Python leverages the Erlang VM, known for running low-latency, distributed and fault-tolerant systems, while also being successfully used in web development and the embedded software domain.) In assistance to above languages below frameworks come into play, 1) Ruby on Rails 2) Laravel 3) Django Databases are the main central storage of any web application. I got experience in both SQL and NoSQL 1) Postgres 2) MongoDB 3) SQLite 4) Mysql The game never ended on the server side for me. Frontend/public facing part of the web application has been also highly evolved. Everyone wants to use Single Page Applications - The SPAs. I got experience in the following 1) Angular JS 2) React JS Testing and Test Driven Development(TDD) is also an essential thing for any solid applications. I can write automated tests in following 1) Rspec 2) Capybara 3) Mocha Deployment is essential to distribute your application out in the wild. I got experience in the following tools and technologies 1) AWS 2) Google Cloud Platforms 3) Capistrano 4) Mina 5) Nginx 6) Passenger Phusion 7) Puma 7) Unicorn
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