DEV Community

Anas Khan
Anas Khan

Posted on

Learning JavaScript #Day-02

Hello folks!

So keeping the excitement intact, spent another few hours of my day in learning JavaScript. I must mention here the fact that this language has seriously got me into its fandom especially after meeting with Arrays.

Being a c++ and a Java guy, the definition of Arrays for me was " kiddo! It's a fixed size container which can hold up certain elements of the same data type".
But, JavaScript got me stunned. No more dealing with data types just declare it and do your thing.

" var Example=['baa','bee', 12, 45] " // That's How you declare your Array in JS, with no higgle-haggle in data types, Pretty amazing.

Well let's not just drool over the Arrays, another thing I first used was the backtick ( ) when using the template string.

Template strings are the string literals which can allow you to add embedded expressions. Syntax-> //any string// ${your expression} //string.

I was so dead confused, took it as a single quote and kicked my brains put on the errors. so GOOGLE helped me out. Template strings are pretty amazing to work with.

Now Functions, Functions are pretty the same as former languages so nothing to scratch my that part of my mind, Just made few programs which include functions, conditionals and arrays to make the "JavaScript" blueprint in my mind.

Also Gone through the 3 important array functions which can be used mainly:-

  1. Shift() and Unshift():
    This Array function gives you the functionality to return the first element of
    the array and insert the element on the start of the index.

  2. Pop() and Push():
    You might know them if you are into Data Structures Stack, well Their function is to Pop up or remove the Last element on the array present and insert on the last index of an Array.

  3. Splice();
    This function is most interesting amongst its two brothers, it adds an element in the middle, and takes 3 parameters.Splice(start, delete count,'your element').

So another interesting day with JS, hoping this dating will go well in the future :)

note- Please give your suggestions on additional information, study materials and different learning approach, please drop in the comment box. Your help will be highly appreciated :)

Thank You.
Adios.
Anas Khan.

Top comments (0)