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.

Objects and Props in Javascript
· ☕ 6 min read
Know how you can use a Javascript object and its props. Javascript objects have properties or props. As you would have seen in the post about objects and primitives, object operations are quite easy. Though objects can mean more than a few things in Javascript, we will limit discussion of an object to the ** real real ** object.

Objects and Primitives in Javascript
· ☕ 3 min read
Get to know all the practical knowledge about Javascript primitives and objects. In JavaScript, objects are king. If you understand objects, you understand JavaScript. - W3 Schools Everything except primitives is an object in Javascript. A couple of days back, we were talking about Javascript having the following primitives: bool, number, string, undefined and null.

Type Casting in Javascript
· ☕ 2 min read
Don’t know how to type? Get a typewriter. I always wanted to say that. But, if indeed you don’t know types - you can always head over to Javascript types to know more**. So, you know there are types. And, you also know that there can be many a problem in the lousy world of loose typing.

Typing Javascript
· ☕ 3 min read
This one thing I never said ever - “once you type, you cannot un-type”. Yep, I make up words and compete on how to level up in my eating my own words. Even if I allegedly uttered those words (which are totally unoriginal anyway), I happily don’t abide by them. I continue to use Javascript without types with all fervour (and have had a stint with typeless / loosely-typed scripting languages).

The v-model Magic
· ☕ 2 min read
In a previous post, we saw the power of bindings in Vue. v-model is a powerful way to bind variables and UI rendering in Vue. Let us look at a bit more of v-model in this post. Remind me what is v-model about? In its simplest form.. 1 <input type="text" v-model="myName" label="Your name:"> .

Vue Reactivity and Binding
· ☕ 4 min read
The power of Vue is in making reactive components child’s play. Well, that is true if the child in question is a 8-year old nephew who knows the basics of Javascript - you know what I mean. Consider an example that I have used before - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 <template> <div class="hello"> <h1>{{ msg }}</h1> <p> <button @click="sayHello">Hello</button> <span v-if="showHello">&nbsp;World!

Switch from if/else hell
· ☕ 4 min read
Imagine you are in need of a complex if/then routine. No, not the below.. 1 2 3 const smart = true; if (smart) console.log("I am smart"); else console.log("I am not so smart"); .. but more of.. 1 2 3 4 5 6 7 8 9 10 11 12 13 function sum(a, b) { let smartMessage; if (a + b <= 0) smartMessage = "Negative numbers are not known and cannot be computed.