Filter Duplicate Attributes in Array of Objects in Javascript
· ☕ 1 min read
Catch duplicate attributes within an array of objects and retrieve unique elements. Array/object in question - 1 2 3 4 5 6 const students = [ { name: "Rama", grade: 10 }, { name: "Kris", grade: 5 }, { name: "Pete", grade: 7 }, { name: "Mo", grade: 5 } ]; We want to get unique grades from the array.

Use Set in Javascript
· ☕ 4 min read
Set was introduced in ES6 and is a collection of values without keys. It has one killer feature that you want to use - filtering duplicates owing to its feature of allowing only unique values. So.. set? People from other languages may be familiar with sets, maps and arrays.. and the confusion that comes with them.

ES6 String Operations That Rock the World
· ☕ 2 min read
There are many great improvements provided by ES6 (introduced in Y2015), but I think a couple of them are really cool. String includes includes checks whether a certain (sub) string exists in the provided string. Note that this operation is case sensitive. 1 2 3 let str1 = "Neo rocks the world"; console.

Private Variables in Javascript Class
· ☕ 2 min read
We define a class and its variables like so - 1 2 3 4 5 6 7 8 9 10 11 12 class UserData { name = ""; type = ""; internalUserFlag = false; constructor({ name, type }) { this.name = name; this.type = type; } } const student1 = new UserData({ name: "Neo" }); console.

Extending Class in Javascript
· ☕ 4 min read
Extend a class and create a sub class for easier maintainability. Sub class can make use of special super functions to extend the functionality of a class. Using sub classes you can build out a complex logic in steps rather than as one messy module. See how to start with a Javascript class and class prototypes if you are new to Javascript classes.

Using Prototypes in Javascript Class
· ☕ 3 min read
Prototypes enable us to define attributes and functions of a class that can be shared across its object instances. Let us look at how we could start using prototypes in our Javascript classes. See how to start with a Javascript class if you are new to Javascript classes. Class in Javascript is built internally using prototypes - in fact that was the way some of us were reaching OOP nirvana in Javascript back in the day.

How to Use Javascript Class?
· ☕ 2 min read
Class in Javascript is syntactic sugar on top of prototypes. Class makes it easier to structure our code, and to read and maintain it. Let’s see a simple class. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 class QuizTracker { constructor() { this.

Array Sort in Javascript
· ☕ 2 min read
Arrays in Javascript can be sorted using a simple .sort command. But, don’t let that simplicity deceive you - it goes far more than that. 1 2 let arr = [4, 2, 1, 7, 3]; console.log(arr.sort()); // [ 1, 2, 3, 4, 7 ] Sort can be used against full strings -

Arrays in Javascript
· ☕ 6 min read
Array is a collection of elements or objects, and is quite easy to use in Javascript. Here’s an example of array: 1 const fruits = ["apple", "orange"]; You can print out the entire array.. 1 2 const fruits = ["apple", "orange"]; console.log("fruits: ", fruits); //fruits: [ 'apple', 'orange' ] .

Passing Arguments to a Javascript Function
· ☕ 2 min read
You can pass one or more values to a function, but that has been made much easier and streamlined with the advent of ES2015 - 2018 standards. Let’s start with a simple function. 1 2 3 4 5 6 function sum(x, y) { return x + y; } const summer = sum(3, 6); console.

Return Multiple Values from Javascript Function
· ☕ 1 min read
A Javascript function returns one and only one value. 1 2 3 4 5 6 function sum(x, y) { return 3 + 39; } let life = sum(3, 39); console.log(life); // 42 I bet you already knew that not returning a value from a function, would return ‘undefined’.

Logical Operators in Javascript
· ☕ 3 min read
AND (&&), Not (!), OR (||) are logical operators in Javascript. You will see that they are the only operators that make up for the entirety of one’s life experiences. Logical operators evaluate two values or expressions, and provide a true or false result. Let us see some examples to know the rules of the game.

Comparison Operators in Javascript
· ☕ 2 min read
Equals (==), not equals (!=), greater than (>), lesser than (<) - Javascript comparison operators cannot get more simple. Let’s dissect these operators a bit. Comparison operators are the ones that you use to.. well, compare. For example: 1 2 3 4 5 6 7 let numCoffee = 3; if (numCoffee < 2) console.