Skip to main content

Command Palette

Search for a command to run...

Javascript 9

Chapter 9 with Examples

Updated
1 min readView as Markdown
Javascript 9
A

I am a passionate front-end engineer with 3 years of experience in developing and implementing innovative software solutions.

Hi everyone, My name is Arinze Calistus. The purpose of this blog is to teach you all you need to know about JavaScript.

Javascript is Dynamic

It may interest you to know that JS is a dynamic language. Variables are not directly associated with a single data type, unlike in other programming languages. Any variable in JS can be reassigned to values of all types.

For Example

var x = " text "; // x is a string
x = true; // x is now a boolean
x = 24;  // x is now a number
document.write(x);

The typeOf Operator

The typeof returns a string indicating the data type of the evaluated operand.

typeOf "Her name is Rachell."; // returns "string"
typeOf 34; // returns "number"
typeOf true; // returns "boolean"
typeOf undefined; // returns "undefined"

Primitive Data

Primitive data are data that are not object and has no methods. There are 4 basic primitive data types:

  • string

  • number

  • boolean

  • undefined

All these primitive data types can be returned by the typeOf operator. Just like in the previous example.

Thanks for reading!!

JavaScript

Part 9 of 11

This blog is all about JavaScript topics from Basics to Advance, along with interview question.

Up next

JavaScript 10

The Real-Deal with Examples

More from this blog

A

Arizon.Dev

12 posts

Hi everyone, My name is Arinze Calistus and I'm a self-taught Full-Stack developer that learned and is still learning through online resources. I would love to connect with people and have a chat.