Romantic Date with JavaScript ❤| Day 1

Hey there, I will try to share what I have learned from documentation about JavaScript in the last 24 hours. Though, I believe I have a good understanding of JavaScript infrastructure still I will try to note down them for future reference. This is only for a personal note, but if you want you can continue reading this.

Building Blocks:
To be good at JavaScript, every beginner should start with understanding its building blocks. Building blocks are the smallest part of a big thing.
So the building blocks of JavaScript are Number, String, Boolean, Function, Object, and recently in Symbol is added as the Building block of JavaScript. But the list is not ended yet. In the building blocks things, there is null and undefined also.

Two types of Number:
The latest version of ECMAScript released a new numeric type, which is “BigInt”. Before then, we just knew the “Number” type. Like, integer, float, double are the number type. So, what is BigInt? Basically, in Number type there is a limitation. We cannot use the maximum limit of value in this type. And the max value is Number.MAX_SAFE_INTEGER which is 9007199254740991, well but what happens when we have to work with larger than this number? To solve this problem, ECMA Script brings a new numeric type which is BigInt. To convert a normal number to a BigInt simply have to append ’n’ at the end of the number.

Slice is an interesting thing, Just forget about programming and think about a cake. When We have to eat a cake we don’t eat the whole cake at once. Rather, we cut that cake into a small piece and then eat that small piece. The same happens in String Splice Function. Whenever we want a specific portion of a string, we use the slice function. It has two parameters start index and end index. This function returns a new String also.

Split almost similar to slice, but the main difference is we have to give a separator or we can say the context where we want to make the split or division. So, This function takes two parameters String or regex pattern as a separator and number as a limit and returns an array. Though both parameters are optional.

This function finds a particular ‘text’ from a selected string. Sometimes, we may need to check if any word exists in a string. Then we could use this function to find. This function takes to parameters. The first one is a String as a search string, which we want to find and the second one is the position as a number which is used to check in a particular position. And this includes function returns the result as a Boolean. It finds the word then It will return true, else it will return false.

This find method is self-explanatory. It finds a particular element of an array and returns the value. This function takes two arguments. The first one is the Callback function and the second one is ‘this’. The second parameter is optional. This function returns the matched element if it fits the condition, but if it didn’t it returns undefined.

indexOf() function is used to find the index/position of a particular array element. Whenever you needed to find the position of a value or if you want to check if an element exists on the array, you can use this function to find it.
It takes two parameters, First one is the element which you wanted to find and the second one is the fromIndex parameter to find searching from a specific position. And It returns the position of the element in the array. If the element is not found it returns -1


This shift() function used to remove the first element from an array. And if the array is empty it returns undefined. As this is a generic function, so it just can be called or applied to an Array. It doesn’t take parameters, but it returns the value that is removed from the Array.

unshift() do the exact opposite of shift(). Unshift function adds a new element to the existing array list as the first index. Even we can add multiple value or array to the first position.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store