JavaScript (not to be confused with Java) is a high-level, dynamic, multi-paradigm, weakly-typed language used for both client-side and server-side scripting.

- Stackoverflow.com Wiki
70 articles, 25 books. Go to books ↓

How to write simple, useful and composable JavaScript applications


How To Shoot Yourself In the Foot With Prototypes!


Stop. For the next 30 days, don’t write any for loops. If you see a nasty pile of those gnarly things, replace them with an each or a map. Do a little reducing.


Promises capture the notion of an eventual value into an object.


This style guide aims to provide the ground rules for an application's JavaScript code, such that it's highly readable and consistent across different developers on a team. The focus is put on quality and coherence across the different pieces of your application.


Ey You C# developer! Wanting to learn you some JavaScript? You’ve come to the right place! In this article you will learn how to map all those OOP C# concepts you have come to know and love to JavaScript, the ever growing language of the web!


It is a prototype-based language. The concept of prototyping implies that behavior can be reused by cloning existing objects that serve as prototypes. Every object in JavaScript depends from a prototype which defines a set of functions and members that the object can use. There is no class. Just objects. Every object can then be used as prototype for another object.


An example of how to calculate the standard deviation for a given data set.


This is intended as a simple abbreviated cheat sheet for securing JavaScript based single page web apps. It's not meant to cover everything in depth, but rather point you in the correct directions with resources.


With the web slowly maturing as a platform the demand for cryptography in the browser has risen, especially in a post-Snowden era. Many of us have heard about the upcoming Web Cryptography API but at the time of writing there seem to be no good introductions available. We will take a look at the proposed W3C spec and its current state of implementation.


Coming from a sane language you might think that this in JavaScript is kind of like this in an object oriented language like Java, something that refers to values stored in instance properties. Not so. In JavaScript it is best to think of the this as a boggart carrying a bag of data with an undetectable extension charm.


Are you a programmer who is considering learning JavaScript, but unsure whether it is worth the pain? Then this blog post is for you: I argue that it is worth it and give tips for surviving the language.


In technical interviews, it is common that the interviewer will throw in a question that tests your knowledge of higher-order functions and function-binding.


A few interesting JavaScript benchmarks and tips.


Most of these techniques involve common sense once you have understood the underlying problem.


I have often seen .NET developers struggle with JavaScript. They try to compare C# functions with JavaScript functions and usually make some minor but conceptual mistakes while using it. We can all agree that JavaScript functions are the backbone of the JavaScript programming language, and if one has a good understanding of the function, then using JavaScript is easier.


Closures are extremely valuable if you know how to use them. The problem is that many JavaScript developers don't know how to use them. After reading this guide I hope you will have a good grasp of what a closure is, how it works, and when to use them.


When dealing with errors, handling them at the perimeter of your application isn't always sufficient. By the time the error bubbles up, you've often lost a lot of the context in which the error was thrown. As such, people will sometimes catch an error, record it locally in some way, and then rethrow it.


In the early days of JavaScript where you needed a simple function for just about everything because the browser vendors implemented features differently, and not just edge features, basic features, like addEventListener and attachEvent. Times have changed but there are still a few functions each developer should have in their arsenal, for performance for functional ease purposes.


A collection of awesome browser-side JavaScript libraries, resources and shiny things.


What the closure is? - It is the object that refers both to function object and the scope object. Actually, all JavaScript functions are closures: it's impossible to have the reference to function object without scope object.


Is the delete operator of any use? There also exists funny named splice() and slice(), what about those? I want to modify the array in-place.


Every developer strives to write maintainable, readable, and reusable code. Code structuring becomes more important as applications become larger. Design patterns prove crucial to solving this challenge – providing an organization structure for common issues in a particular circumstance.


Unlike most other languages, JavaScript’s object system is based on prototypes, not classes. Unfortunately, most JavaScript developers don’t understand JavaScript’s object system, or how to put it to best use. Others do understand it, but want it to behave more like class based systems.


This post is aimed at those wanting to learn about the many depths of JavaScript after hearing words such as scope, closure, this, namespace, function scope, global scope, lexical scope and public/private scope.


Ebay thought they were secure, you see. They thought they'd done everything right. Sure, their regex only matched alphanumeric characters inside script tags, but really, who writes javascript without using letters or numbers? How much harm could possibly be done?


Accept that sometimes, or for some people, your JavaScript will not work. Put some thought into what that means. Err on the side of basing your work on existing HTML mechanisms whenever you can. Maybe one day a year, get your whole dev team to disable JavaScript and try using your site.


If you are new to JavaScript or it has only been a minor part of your development effort until recently, you may be feeling frustrated. All languages have their quirks – but the paradigm shift from strongly typed server-side languages to JavaScript can feel especially confusing at times.


Learn about the past, present and future of dependency inversion in JavaScript


Probably the second most enduring myth about JavaScript is that the for..in statement loops through the indexes of an array. It doesn't, and if you write code that assumes it does, then even if the code doesn't break in its nice cozy nest on your computer, it's likely to as soon as you expose it to the complexities of the outside world.


Whether you’re building a new mobile app or a hobby piece, time is usually pretty precious – it certainly helps to have a few extra tips in the bag when it comes to knowing how to debug JavaScript properly…


Closures are a fundamental JavaScript concept that every serious programmer should know inside-out.


Method chaining is a common pattern in the JavaScript world. This tutorial will provide a brief explanation of what method chaining is, give a real world example of how jQuery uses method chaining, and teach you how to add method chaining to your own classes.


A JavaScript Promise represents the result of an operation that hasn't been completed yet, but will at some undetermined point in the future. An example of such an operation is a network request. When we fetch data from some source, for example an API, there is no way for us to absolutely determine when the response will be received.


There are many times in JavaScript when you want to do something with an array of ‘stuff’. Perhaps you want to create a subset of the array elements. Perhaps you want to create something else with each of the elements.


What does “pure function” mean in the context of JavaScript? In programming in general, purity is also known as “referential transparency”, a fancy way of saying “replacing an expression or function call with its result will never change the behavior of the program” or a way of saying “every time you pass the same inputs, you always get the same outputs”.


When you are writing JavaScript, callbacks are one of the most confusing concepts. Promises are the new approach to improve working with async code.


Numerous concepts appearing in JS blogs and documentation are still unfamiliar to many front-end developers. In this post series, we'll learn intermediate and advanced concepts in the current front-end programming landscape and explore how they apply to modern JavaScript.


As web developers, we know how easy it is to end up with web page bloat. But loading a webpage is much more than shipping bytes down the wire. Once the browser has downloaded our page’s scripts it then has to parse, interpret & run them. In this post, we’ll dive into this phase for JavaScript, why it might be slowing down your app’s start-up & how you can fix it.


Learning modern JavaScript requires human intervention. Things haven’t settled down long enough for curriculums and guides to gel and mature, and for best practices to become authoritative for more than a few months. If you don’t have a human expert at hand, at the very least, check the date on that Medium article or tutorial or the last commit in that GitHub repository. If it’s more than a year old, it’s almost certainly not the way to go.


In case you missed it, Node now supports async/await out of the box since version 7.6. If you haven’t tried it yet, here are a bunch of reasons with examples why you should adopt it immediately and never look back.


With familiarity, in-line arrow functions are the most readable way to express curried functions in JavaScript.


Few months ago I saw an email asking if someone could unwrap this one line of JavaScript. It was created by Mathieu ‘p01’ Henri, author of www.p01.org where you can find this and many other cool demos.