DEV Community

Cover image for Core Fundamentals of JavaScript
Eftykhar Rahman
Eftykhar Rahman

Posted on • Updated on

Core Fundamentals of JavaScript

Alt Text

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.

image

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); 
Enter fullscreen mode Exit fullscreen mode

// 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)); 
Enter fullscreen mode Exit fullscreen mode

// which is equal to 2

console.log(Math.ceil(5/2)); 
Enter fullscreen mode Exit fullscreen mode

// 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)); 
Enter fullscreen mode Exit fullscreen mode

// 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()); 
Enter fullscreen mode Exit fullscreen mode

// which gives the value ‘RAUFU’

console.log(‘RaUFu’.toLowerCase()); 
Enter fullscreen mode Exit fullscreen mode

// which gives the value “raufu”

Array

This is used to keep elements of any type-together.

const names = [‘Raufu’, ‘Prezens’]

console.log(names.length); 
Enter fullscreen mode Exit fullscreen mode

// which gives the value 2 that is basically the total number of elements in the array.

console.log(names[0]); 
Enter fullscreen mode Exit fullscreen mode

// 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
Enter fullscreen mode Exit fullscreen mode

I will try to update the article later and thank you for reading this article.

Latest comments (1)

Collapse
 
iamraufu profile image
Eftykhar Rahman

Thank You