Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 8014

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 60k
Author
Asked: November 28, 20242024-11-28T09:10:09+00:00 2024-11-28T09:10:09+00:00

JavaScript Struggles – Part 5 | Data Types

  • 60k

Hey there! πŸ‘‹πŸ»
We're now going to explain the data types of JavaScript, I'm only going to talk this time about the data types itself, ⚠️ I'm not going to explain the (truthy & false) subject now ⚠️.

This's just a basic view of the data types of JavaScript.


Data types:-

  • Undefined
  • Null
  • Number
  • String
  • NaN

Undefined

Undefined is actually a data type in JavaScript.
Even though that is weird, but you'll get used to it.

it's the default data type if you didn't assign anything in the variable.

var varName;   console.log(typeof varName); // outputs: undefined 
Enter fullscreen mode Exit fullscreen mode


Null

Null is a data type that have to be assigned.
The best use of it is to find the undefined variables.

Also important to know that null is an object so whenever you want to check the data type of a variable that contains a null it'll return “object”.

var nullVariable = null; var nothingHere;  console.log(nullVariable == nothingHere); // that will output true 
Enter fullscreen mode Exit fullscreen mode

But the confusing sometimes, but no worries I covered it already on a previous post


Number

The data type number is so familiar for most developers, it have a number. πŸ™‚

Simple right?

But sometimes JavaScript has to be JAVASCRIPT, and add some weird things around it.
It's considered bad at math, or to be more specific; it's actually bad at float-point

Which I'll cover in upcoming post, so stay tuned.


String

String is actually so simple.

It's just like the string of any other language but with some features.

There's 3 ways of using string in JavaScript:

  • Single quote 'string'
  • Double quote "string"
  • And the backticks

Single quote 'string'

The single quotes is used just as the normal string.

let stringVar = 'Hello world!'; 
Enter fullscreen mode Exit fullscreen mode

Double quote "string"

This is the normal string itself!!
I think it doesn't need an explanation.

Backticks

What is even backticks?
It's the string that uses ` instead of ” or '

It's actually the best practice in my opinion for JavaScript at it provides the furmated string feature with it as you use it, also enables using multiple lines (it doesn't apply on web as you need to use <br />).

let furmattedString = `the answer is ${5 + 5}`;  console.log(furmattedString); // the answer is 10  let multilineString = `Hello there! I'm Abdelrahman!`; console.log(multilineString); /* Hello there! I'm Abdelrahman! */  
Enter fullscreen mode Exit fullscreen mode


NaN

I've already explained NaN in previous post
So let me be the lazy developer I am and not repeat that again πŸ₯±


That's all for now! I hope you gain anything new from this post. πŸ˜„

beginnersjavascripttutorialwebdev
  • 0 0 Answers
  • 8 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 2k
  • Popular
  • Answers
  • Author

    ES6 - A beginners guide - Template Literals

    • 0 Answers
  • Author

    Understanding Higher Order Functions in JavaScript.

    • 0 Answers
  • Author

    Build a custom video chat app with Daily and Vue.js

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.