Tag: javascript

Home / javascript
Removing JavaScript’s “this” keyword makes it a better language. Here’s why.
Post

Removing JavaScript’s “this” keyword makes it a better language. Here’s why.

this is of course the source of much confusion in JavaScript. The reason being that this depends on how the function was invoked, not where the function was defined. JavaScript without this looks like a better functional programming language. this losing context Methods are functions that are stored in objects. In order for a function to know on which object to...

Better loops in JavaScript
Post

Better loops in JavaScript

In this post, we will take a look at forms of for loop, array methods using which you can make your code simpler, more readable. These loops / methods are useful when you want to manipulate data in an array or object. for in loop With this kind of loop you don’t have to iterate...

JavaScript Inheritance and the Prototype Chain
Post

JavaScript Inheritance and the Prototype Chain

This post is designed to be read after you read JavaScript Private and Public Class Fields. Previously we learned how to create an Animal class both in ES5 as well as in ES6. We also learned how to share methods across those classes using JavaScript’s prototype. To review, here’s the code we saw in an earlier post. function...

Map, Filter, Reduce vs For Loops (syntax)
Post

Map, Filter, Reduce vs For Loops (syntax)

The intention of this post is not to say one paradigm is better than the other. It is just to show common imperative patterns you run into and their functional equivalents. Sometimes things are easier to learn if you can relate it to something you are already familiar with and be given a map on...

Will WebAssembly replace JavaScript? Or Will WASM Make JavaScript More Valuable in Future?
Post

Will WebAssembly replace JavaScript? Or Will WASM Make JavaScript More Valuable in Future?

Since the time WebAssembly started gaining traction, a question has arisen among the developers: Will it put an end to JavaScript? Whereas, some developers and enterprises think that WebAssembly will complement JavaScript and accelerate the web development. What is WebAssembly? WebAssembly (WASM) is a binary instruction format which has been built to compile high-level languages...

JavaScript guard clauses – how you can refactor conditional logic
Post

JavaScript guard clauses – how you can refactor conditional logic

Originally published at medium.freecodecamp.org. Learn about guard clauses in JavaScript and how to use them to refactor your code. This short refactoring tutorial will explain how you can write guard clauses for your if statements, rather than using nested if .. else conditional logic. This can help you to create clean and easy to read code. It will...

Getting to know some pragmatic programming language features
Post

Getting to know some pragmatic programming language features

As you know, in the Pragmatic Programmer, section Your Knowledge Portfolio, it is said that Learn at least one new language every year. Different languages solve the same problems in different ways. By learning several different approaches, you can help broaden your thinking and avoid getting stuck in a rut. Additionally, learning many languages is far easier...

Rethinking JavaScript: The complete elimination and eradication of JavaScript’s this.
Post

Rethinking JavaScript: The complete elimination and eradication of JavaScript’s this.

If this is so difficult to reason about, why don’t we just stop using it? Seriously. Why. don’t. we. just. stop. using. it.? If you have read How I rediscovered my love for JavaScript after throwing 90% of it in the trash, then you won’t be surprised when I say I am throwing this away. this is gone. goodbye. this won’t be missed. With functional...

Understanding JavaScript Iteration with C#
Post

Understanding JavaScript Iteration with C#

As I was chatting, someone from Coding Blocks slack channel (#javascript) has asked a question regarding a code snippet var uniqueInOrder = function (iterable) { return [].filter.call(iterable, (function (a, i) { return iterable[i – 1] !== a })); } view rawuniqueInOrder.js hosted with ❤ by GitHub His question was “Kinda lost in the [].filter.call , etc part.” I will show you...

Coding Concepts – Reflection
Post

Coding Concepts – Reflection

Reflection – What you need to know. In computer science, reflection is the ability of a computer program to examine, introspect, and modify its own structure and behavior at runtime.[1] So what does that mean? Reflection is a term thrown around every now and again and but do you really know what it means? Why...

Looping through objects in JavaScript
Post

Looping through objects in JavaScript

Once in a while, you may need to loop through Objects in JavaScript. The only way to do so before ES6 is with a for...in loop. The problem with a for...in loop is that it iterates through properties in the Prototype chain. When you loop through an object with the for...inloop, you need to check if the property belongs to...

Why you shouldn’t reassign values in JavaScript
Post

Why you shouldn’t reassign values in JavaScript

In JavaScript, you can reassign values to variables you declared with let or var. I used to reassign values a lot. But as I got better with JavaScript, I realized you shouldn’t reassign values if you can. This is because: You may change external state by accident when you reassign values You create more complex code when you...

Async programming basics every JS developer should know in 2018
Post

Async programming basics every JS developer should know in 2018

This article is aimed at people starting out with asynchronous coding in javascript so we would keep things simple by avoiding big words, arrow functions, template literals etc. Callbacks are one of the most used concepts of modern functional javascript and if you’ve ever used jQuery, chances are you’ve already used callbacks without even knowing...

How Destructuring Works in JavaScript
Post

How Destructuring Works in JavaScript

Destructing helps to write less code and easy way to access the properties in JavaScript. Object destructuring.💔 Suppose we have an object literal. let obj={ name:'sai', show:true } How can we access the properties in Object? The answer is we are using dot notation to access the object properties Like we need to use obj.propertyname or...

The syntactical Sugar Classes of JavaScript
Post

The syntactical Sugar Classes of JavaScript

In my previous article; Getters And Setters used in JavaScript Objects….How? Ogwuru Johnson #javascript#tutorial#programming we looked at Getters and Setters as they apply to objects in JavaScript and i recall promising to show us how we could use getters in Es6 classes, We would also learn a great deal about classes. First of; i wouldn’t...

Functional Programming with JavaScript ES6
Post

Functional Programming with JavaScript ES6

Functional programming is a style that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data. Original post @ http://www.ajinkyaxjs.com/2018/05/02/functional-programming-es6-cheatsheet.html Arrow Functions (Fat Arrows) Arrow functions create a concise expression that encapsulates a small piece of functionality. Additionally, arrows retain the scope of the caller inside the function eliminating the need of...

How components won the “framework wars”
Post

How components won the “framework wars”

React vs Angular vs Vue: Why it doesn’t matter. 2018 marks the end of JavaScript fatigue and the “framework wars” A typical frontend/JavaScript developer career usually involves some jQuery and associated plugins before moving on to React, Angular or Vue. Having experienced React, Vue and Angular, it seems they solve similar problems in a similar...