Skip to main content

Why is Javascript said to be a Dynamic Language?



What is Javascript?

JavaScript, JS is well known as scripting language for Web pages. 
Many server and desktop program also use JavaScript.
It is an object oriented programming language which is designed to make the web development easy and very attractive. It is Used with HTML and CSS and is very important tool for any web developer. 

So Why Do you think that Javascript is called as a Dynamic Language?
Consider the example shown below: 
Here I assign the 'Peter' for the variable called 'name' 
let name='Peter'; 

                                                                                                           
In the browser Chrome Console, if you enter typeof(name), you will get the type shown as String as shown below:

Here typeof is a reserved keyword. 
Later If I assign a value 1 for name 
            name=1; 
            console.log(name); //this will return a value 1 
Now in the browser console, if you enter typeof (name), you will get the type shown as "number". 
Consider one more example :
            let age=30; 
Now in the console, if you enter- typeof name, you will get the type shown as "number". 
Later if you assign age with some floating point number Eg: age=30.1;
Still typeof(age) , you will get as "number". 

Unlike other programming languages, in javascript we dont have 2 types of numbers- floating and integers. 
That is why we say that javascript is a dynamic language. 
Unlike static languages, the type of the variables can be determined at runtime based on the values that is assigned to them.

Hopefully now it is clear that why Javascript is called a Dynamic language.
Any Suggestions are always welcome. :)


Comments

Popular posts from this blog

5 ways to Stay Fit While Working From Home

Covid-19 and the lockdown are the over debated and hot topics this year.  While the world is arguing about the spread of the virus as a conspiracy against the other countries, the spread of coronavirus still remains a mystery.  So, let’s leave the topic to them and move our focus to a topic which according to me is equally important and that is our Fitness.  As there is a state of lockdown in most parts of the world, most of the employees are working from home.  While work from home is the need of the hour, the precious thing we forget is our health and our fitness.  Work from home gives you the flexibility that your entire house can be your workplace.  However, if your work is heavily dependent on the internet then the above point may not be applicable to a few. But jokes apart, amidst this flexibility, we often ignore our sitting postures, our lunch timings, our family time and some people like me even forget to keep ourselves hyd...

What is Cloud Computing?Explain with Examples

Cloud Computing is a process of using the internet or remote servers to store, access, manage, and process data or programs rather than using the local server or the computer.  In simple language, it uses the pay as you go approach.  Cloud computing is basically the delivery of on-demand system resources like storage, high power servers, software, etc. over the network.  It’s like the renting of resources rather than buying them. As a day to day example, suppose if a tourist visits a place and has a plan of spending a 5-day vacation at that place.  Then will he buy a house there or will he rent a hotel? Cloud also works on similar lines. If a person wants to start a business and so he needs a 100 GB RAM to sever today.  So he goes and buys the server by spending a huge amount and later after a few days he suffers a huge loss. He thus decides to buy a 50 GB RAM Server.  What will he do of the old server?  Now, instead of buying the server if he had mad...