₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,058 members, 8,420,080 topics. Date: Thursday, 04 June 2026 at 11:01 AM

Toggle theme

Javascript Data Types And Functions - Webmasters - Nairaland

Nairaland ForumScience/TechnologyWebmastersJavascript Data Types And Functions (704 Views)

1 Reply

Javascript Data Types And Functions by Venzee(op): 2:46pm On Jul 04, 2019
Before I will start, in web development there there two language you must learn before learning JavaScript, and they are:

HTML and CSS . You should learn this language before learning JavaScript.

JAVASCRIPT DATA TYPES

JavaScriptvariables can hold many data types: numbers, strings, objects and more:
var length = 16;                               // Number
var lastName = "Johnson";                      // String
var x = {firstName:"John", lastName:"Doe"};    // Object
The Concept of Data Types

In programming, data types is an important concept.

To be able to operate on variables, it is important to know something about the type.

Without data types, a computer cannot safely solve this:

var x = 16 + "Volvo";

Does it make any sense to add "Volvo" to sixteen? Will it produce an error or will it produce a result?

JavaScript will treat the example above as:

var x = "16" + "Volvo";

When adding a number and a string, JavaScript will treat the number as a string.

Example
var x = 16 + "Volvo";

»

Example
var x = "Volvo" + 16;

»

JavaScript evaluates expressions from left to right. Different sequences can produce different results:

JavaScript:
var x = 16 + 4 + "Volvo";
Result:
20Volvo

»

JavaScript:
var x = "Volvo" + 16 + 4;
Result:
Volvo164

»

In the first example, JavaScript treats 16 and 4 as numbers, until it reaches "Volvo".

In the second example, since the first operand is a string, all operands are treated as strings.

JavaScript Types are Dynamic.

JavaScript has dynamic types. This means that the same variable can be used to hold different data types:

Example
var x;               // Now x is undefined
var x = 5;           // Now x is a Number
var x = "John";      // Now x is a String

Learn JavaScript for free both online or offline, with our ebooks guide and examples
Use[color=#990000][/color] the link below

https://idreamng.com/web-masters/javascript-data-types-and-functions/13/

Get the all in one HTML and CSS Tutorial.
Also use the link below
https://idreamng.com/shop
1 Reply

List Websites Or Forums Designs With Exact Functions Like Nairaland Currently??Javascript Data Types#get Responsive Website Developed Fast In Short Time. #php, #javascript....234

How You Can Make Money BloggingFresh Non-verified Uk Adsense For SaleGet In Here If You Need A US Number For Whatsapp.