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 hydrated.☺ These things which we a

5 DifferentThings to do in Quarantine 2020- Free Time

Things to do in Quarantine 2020| Free Time  Quarantine..Vacations…Post retirement days… seem quiet different terms but all these have one thing in common. – Free time . Duration may vary based on your plans of course.  As the saying goes by, wasted time never returns. So, it is good to use your spare time in the best possible way. Here are some ideas which that might help you invest your free time. Knock!! Knock!! Disclaimer here: Although the title says, things to do in quarantine - you may use these tips any day during your free time 1.          LEARN A NEW LANGUAGE I know, you may now say there is no point in learning a new language now. The evil pandemic has ruined all the travel plans.  But, I strongly believe in one thing that nothing is permanent. The virus is there today and it will vanish away sooner or later. So use this free time to learn the regional language of your dream holiday destination. A small financial tip here- Learning a new language not only helps you with your