Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d6c5dd1

Browse filesBrowse files
authored
Create main
1 parent 84ac012 commit d6c5dd1
Copy full SHA for d6c5dd1

File tree

1 file changed

+41
-0
lines changed
Filter options

1 file changed

+41
-0
lines changed

‎main

Copy file name to clipboard
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//================================================================
2+
//================================================================
3+
4+
//[Variables]//
5+
var example = true;
6+
example = 'Israel'; // overwritten
7+
console.log(example); // console does this.
8+
9+
10+
const example = true;
11+
example = 'Israel'; // get error
12+
console.log(example); // SyntaxError
13+
// constants cannot be overwritten with values
14+
15+
//If we need to overwrite we use 'let'
16+
17+
//================================================================
18+
//================================================================
19+
20+
//[Strings]//
21+
22+
let name = "Dylan";
23+
console.log(typeof name); // find out what name is. console result 'string'
24+
25+
26+
let firstName = 'Dylan';
27+
let lastName = 'Israel';
28+
29+
console.log(firstName + '' + lastName); // concatenation '' give space in between two vars
30+
//result Dyalan Israel
31+
32+
console.log(`${firstName} ${lastName}`); // new method called string interpolation
33+
console.log( `${firstName} ${lastName}`.length); // string property, function length to show the length
34+
console.log( `${firstName} ${lastName}`.trim().length); // trims all the spaces and counts the characters
35+
console.log(`${firstName} ${lastName}`.toUpperCase()); //change all to upper case or even lower case using toLowerCase()
36+
console.log(`${firstName} ${lastName}`.split(' ')); // split this once it detects the space, our value will be an array ["Dylan", "Israel"], if using just split('') it can break each of the letters individually
37+
38+
//================================================================
39+
//================================================================
40+
41+
//[Numbers]//

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.