4.1.1. More On Strings¶
console.log(typeof "17");
console.log(typeof "3.2");
/*What about values like "17" and "3.2"? They look like numbers,
but they are in quotation marks like strings.
Run the following code to find out./*
4.1.1. More On Strings¶
console.log(typeof "17");
console.log(typeof "3.2");
/*What about values like "17" and "3.2"? They look like numbers,
but they are in quotation marks like strings.
Run the following code to find out./*
4.1.1. More On Strings¶
console.log(42000);
console.log(42,000);
//42000
//42 0
4.1.1. More On Strings¶
console.log(typeof 'This is a string');
console.log(typeof "And so is this");
//string
//string
4.1.1. More On Strings¶
console.log(42, 17, 56, 34, 11, 4.35, 32);
console.log(3.4, "hello", 45);
//42 17 56 34 11 4.35 32
//3.4 hello 45
4.1.1. More On Strings¶
console.log('Bruce's beard');
/*Strings in JavaScript can be enclosed in either single quotes (')
or double quotes (").Double-quoted strings can contain single quotes
inside them, as in "Bruce's beard", and single quoted strings can have
double quotes inside them, as in 'The knights who say "Ni!"'.
JavaScript doesn't care whether you use single or double quotes to
surround your strings. Once it has parsed the text of your program or
command, the way it stores the value is identical in all cases, and the
surrounding quotes are not part of the value./*
Warning
If a string contains a single quote (such as "Bruce's beard")
then surrounding it with single quotes gives unexpected results./*
console.log('Bruce's beard');*/
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us