Core Fundamentals of JavaScript
Eftykhar Rahman
Posted on May 12, 2021
JavaScript is the most hated programming language in the world. Do you know what’s the most loved language in the world? It’s JavaScript.
And do you know what’s the most popular programming language in the world? It’s again JavaScript. Then why do so many people hate JavaScript?
Because they don’t understand JavaScript. So understanding the core fundamentals of JavaScript is really very important.
Closures, Prototype, Event Loop, Async Await 90% of the developers don’t understand this concept properly. And that's the main reason why they even fail in the job interviews. But don’t worry I am here with you. Just tail on me with this article and realize JavaScript is really easy. In fact, it’s the most beautiful programming language in the world.
You know the main mission of this article is to make you fall in love with JavaScript. I’ll put all my efforts to make everything absolute easy on this article. So as you move ahead I’ll be sharing how JavScript works and how exactly code is executed behind the scenes inside the javascript engine. So what are you waiting for? Let’s get started.
JavaScript types are Number, bigInt, String, Boolean, Function, Object, Symbol(basically an ES2015 feature, we’ll talk about that later), Object, Function, Array, Date, RegExp, null, undefined. Moreover, there are some built-in error types as well.
Number
This is a built-in numeric type. There are an enormous amount of methods we can use with the number. I am listing something mostly used and important number methods:
If we start from the very beginning and most used debug tool which is the console.
console.log(5/2);
// which is equal to 2 which gives the value of 2, not 2.5.
Therefore, if we want to get the upper closest or the lower closest value we’ll use Math.ceil and Math. floor respectfully.
For example,
console.log(Math.floor(5/2));
// which is equal to 2
console.log(Math.ceil(5/2));
// which is equal to 3
Strings
This is used to manipulate a queue of characters. Useful for holding data that can be represented in text format.
console.log(‘raufu’.charAt(1));
// which give the output ‘a’ as it starts the count from 0 and in 1st index position there is ‘a’
Apart from this .toUpperCase() and .toLowerCase() methods give output in all characters of string in upper case and lower case respectfully.
console.log(‘raufu’.toUpperCase());
// which gives the value ‘RAUFU’
console.log(‘RaUFu’.toLowerCase());
// which gives the value “raufu”
Array
This is used to keep elements of any type-together.
const names = [‘Raufu’, ‘Prezens’]
console.log(names.length);
// which gives the value 2 that is basically the total number of elements in the array.
console.log(names[0]);
// which gives the value Raufu as it is in the first position.
Math
This is built and has methods for mathematical functions. It basically works with the Number type.
Math.abs(a); returns the value of a in absolute form
Math.random(); returns random value everytime it is called
I will try to update the article later and thank you for reading this article.
Posted on May 12, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.