Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,143,290 members, 7,780,673 topics. Date: Thursday, 28 March 2024 at 07:12 PM |
Nairaland Forum / Science/Technology / Webmasters / Javascript Data Types And Functions (597 Views)
Javascript Data Types / Understanding All Link Types And SEO / New Nairaland Forum andriod app With All Functions (2) (3) (4)
(1) (Reply)
Javascript Data Types And Functions by Venzee(m): 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)
How To Be Productive And Stay Ahead As A Blogger / Sport Website For Sale / Add Extra Charge To Cash On Delivery For Magento 2 Marketplace Products
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10 |