avatarRajdeep Singh

Summary

The provided web content is a comprehensive guide on data types in JavaScript, detailing the differences between primitive and non-primitive data types, how to declare variables, and the use of the typeof operator to determine variable types.

Abstract

The article "Data Type In Javascript" delves into the fundamental concepts of data types within JavaScript. It explains that JavaScript, being a dynamically typed language, does not require explicit declaration of variable types, as the JavaScript engine infers them. The language provides two main categories of data types: primitive and non-primitive. Primitive data types include Undefined, Null, Boolean, String, Symbol, and Number, while non-primitive data types are Object and Function. The article also demonstrates how to store data using var, let, and const keywords and emphasizes the importance of understanding data types for efficient coding. Additionally, it provides practical examples and a live demo through CodeSandbox to illustrate the concepts discussed. The article concludes with an invitation for readers to engage with the author through comments and contact information, as well as a recommendation for an AI service.

Opinions

  • The author, Rajdeep Singh, expresses a strong belief in the importance of understanding data types for writing effective JavaScript code.
  • Singh suggests that JavaScript's dynamic typing is beneficial as it simplifies variable declaration.
  • The author provides a personal touch by inviting readers to reach out with queries, corrections, or suggestions, indicating a commitment to community engagement and learning.
  • Singh endorses an AI service as a cost-effective alternative to ChatGPT Plus (GPT-4), implying confidence in the service's performance and value for money.
  • The inclusion of external links to further reading and personal contact information reflects the author's dedication to sharing knowledge and being accessible to the reader.

Javascript

Data Type In Javascript?

In This Article, We Learn what Data Type is in javascript😍 and How many data types are in javascript.

Data Type In Javascript

Let's Start it

DEMO:

What is data?

Any name, number, true, and value is data in javascript.

var name='Rajdeep Singh'; 
let number=677;
const boolen=true;
// name is variable name and Rajdeep Singh is data store in variable

How to store Data in Javascript?

In javascript, we store data using var, let, and const keywords.

var data='Rajdeep Singh'; 
let number=677;
const rendomData='xyz';

How Many Data Types In Javascript?

The ECMAScript language Provide two types of data type in javascript

Note:

Javascript is a Dynamic Type of Language. You don't need to specify the type of variable in javascript. because it is a dynamic declare by javascript engine

  1. Primitive Data Type
  2. Non-Primitive Data Type

Primitive Data Type:

Primitive Data Type in javascript is Undefined, Null, Boolean, String, Symbol, and Number

var name='Rageep Singh' //string type
let number=56;  // Number type
const=true;    // boolean type
let undefind; // undefind type
let Null = null; // null type
typeof Symbol('Rajdeep') // symbol type

Non-Primitive Data Type

Primitive Data Type in javascript is Object and Function

let Object={
  name:"Rajdeep",
  lastName:"Singh"
}// object type
let Array=[1,2,3,"rajdeep" ,'singh',5.7] // object type
let Regex=/regex here/gi  // object type
function(){} // function typE

How to Check Variable Type?

The typeof operator tells the Type of Variable

typeof {name:'John', age:34} // Returns "object"
typeof [1,2,3,4]             // Returns "object" not "array"
typeof null                  // Returns "object"  
typeof function myFunc(){}   // Returns "function"
typeof true // return boolean
typeof "Rajdeep Singh"   // return string
typeof '' // return string;
typeof 37        // return number';
typeof 3.14 // return number
typeof Symbol() // symbol type
typeof Symbol('Rajdeep') // symbol type

Demo

Read More On Medium

Reference

Conclusion

Javascript is provided to us dynamic declares a variable by javascript engine (Chrome Brower, Firefox Brower ).

Suppose there are Any queries, mistakes, and Suggestions. Then, please, tell me in the comment box.

Contact me:

Thanks for Reading

JavaScript
Javascript Tips
Javascript Development
Javascript Frameworks
Data Type
Recommended from ReadMedium