JavaScript Data Types Program

Here's a simple JavaScript program that demonstrates the different data types in JavaScript:

This program declares and assigns values to three variables: num, str, and bool. The variable num is assigned the value of 5, which is a number data type. The variable str is assigned the value of "Hello World", which is a string data type. The variable bool is assigned the value of true, which is a boolean data type.

The document.write() method is used to display the value of each variable on the screen. The + "<br>" is used to add a line break after each value.

This program demonstrates how to declare variables in JavaScript and assign different data types to them like number, string and boolean. It also shows how to display the value of each variable on the screen.

You can use any text editor that supports HTML and JavaScript like Visual Studio Code, Sublime Text, Atom or any other text editor that supports javascript.

This program is a basic introduction to data types in JavaScript, and it can be used as a starting point for learning more about the different data types and the operations that can be performed on them.

Please note that JavaScript also supports other data types like Array, Object, Symbol and others, this program is only showcasing the basic data types which are widely used.

Please let me know if you have any questions or need further assistance.


No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.