Category: Javascript

Javascript

ES6 Function Parameters

In ES6 there are multiple enhancements in defining function parameters - default, rest and spread. DefaultYou can set a default value for a function parameter. RestFirst parameter of a function can

Javascript

ES6 Destructuring

Using this feature values can be assigned to variables by matching patterns in an array or object. This is fail-soft, so if match fails, a variable will be initialized as undefined In the last two ex

Javascript

ES6 Template Literals

In ES5 to create a dynamic string, static string parts have to be concatenated with Javascript variables. ES6 introduces template literals using which manual concatenation can be avoided. See the exam

Javascript

ES6 Object Literals

ES6 enhances the syntax used to initiate an Object. See the example below. Another example that shows how local variables and functions can be easily used in the object literal x)() ]: x * 10,

Javascript

ES6 Class

Classes are one of the major features of ES6. In fact it wraps prototype based Object Oriented design and provides the developer a better and easier method to write code. It also helps developers who

Javascript

ES6 Arrow Functions

In ES6, a function can be written in a new way using =>. x/10; myFunc(50); // gives 5 --> This is useful in writing nameless handler functions. It has the same context as the code from which it i

Javascript

Recursively using a partial in Handlebars

The examples below show how a partial can be called in itself. It is useful in creating a dynamic nested menu. Frameworks:jQuery 1.9.1, Handlebars 4.0.6(update) IMPORTANT: As it is recursion, m

Javascript

Custom Handlebars Helper

The example below shows how custom helpers can be defined for Handlebars. Frameworks:jQuery 1.9.1, Handlebars 4.0.6(update)

Javascript

Javascript : Object, Function, Prototype

Object As we know an object is something that exists and owns a set of properties. The term object is used to refer anything in Javascript. From the list of objects available in Javascript, let us ex