This repository was archived by the owner on Apr 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirst.js
62 lines (44 loc) · 1.98 KB
/
first.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// This is tutorial to learn JS Good Parts, and build yourself a new skill
document.writeln("Hello, JS, good parts");
/*
This is how to write methods and functions in JS
Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
};
More details about this would be in fourth.js
*/
/*
There is a var data type that can be used for any data type of a variable
Also, there are following keywords:
**************
abstract
boolean break byte
case catch char class const continue
debugger default delete do double
else enum export extends
false final finally float for function
goto
if implements import in instanceof int interface
long
native new null
package private protected public
return
short static super switch synchronized
this throw throws transient true try typeof
var volatile void
while with
****************
There is no Integer or int data type and hence in JS, 1 is same as 1.0
This is a significant conve- nience because problems of overflow in short integers are completely avoided, and all you need to know about a number is that it is a number.
A string literal can be wrapped in single quotes or double quotes. It can contain zero or more characters. The \ (backslash) is the escape character. JavaScript was built at a time when Unicode was a 16-bit character set, so all characters in JavaScript are 16 bits wide.
"A" === "\u0041"
Strings have a length property. For example, "seven".length is 5.
Strings are immutable. Once it is made, a string can never be changed.
But Strings are easily appended using "+" operator.
Two strings containing exactly the same characters in the same order are considered to be the same string. So:
'c' + 'a' + 't' === 'cat'
There are usual programming loops in JS, just like in C, C++, Java, Python or any other conventional coding language you might be knowing,
Same loops and syntax for while, for, do while, switch and others.
That's it for introduction, let's move on to Objects, in second.js
*/