Skip to main content

Posts

Showing posts with the label javascript data types with examples

What are the data types and variables in JavaScript? and example of sum operation on hindi variables.

Datatypes in JavaScript There are majorly two types of languages. First, one is  Statically typed language  where each variable and expression type is already known at compile time. Once a variable is declared to be of a certain data type, it cannot hold values of other data types. Example: C, C++, Java.  // Java(Statically typed) int x = 5   // variable x is of type int and it will not store any other type. string y = 'abc' // type string and will only accept string values Other,  Dynamically typed languages : These languages can receive different data types over time. For example- Ruby, Python, JavaScript etc. // Javascript(Dynamically typed) var x = 5; // can store an integer var name = 'string' ; // can also store a string. JavaScript is a dynamically typed (also called loosely typed) scripting language. That is, in JavaScript variables can receive different data types over time. Datatypes are basically typed data that can be used and manipulated in a pr...