|
| 1 | +// This is tutorial to learn JS Good Parts, and build yourself a new skill |
| 2 | + |
| 3 | +document.writeln("Hello, JS, good parts"); |
| 4 | + |
| 5 | +/* |
| 6 | +This is how to write methods and functions in JS |
| 7 | +
|
| 8 | +Function.prototype.method = function (name, func) { |
| 9 | + this.prototype[name] = func; |
| 10 | + return this; |
| 11 | +}; |
| 12 | +
|
| 13 | +More details about this would be in fourth.js |
| 14 | +
|
| 15 | +*/ |
| 16 | + |
| 17 | +/* |
| 18 | +
|
| 19 | +There is a var data type that can be used for any data type of a variable |
| 20 | +Also, there are following keywords: |
| 21 | +
|
| 22 | +************** |
| 23 | +abstract |
| 24 | +boolean break byte |
| 25 | +case catch char class const continue |
| 26 | +debugger default delete do double |
| 27 | +else enum export extends |
| 28 | +false final finally float for function |
| 29 | +goto |
| 30 | +if implements import in instanceof int interface |
| 31 | +long |
| 32 | +native new null |
| 33 | +package private protected public |
| 34 | +return |
| 35 | +short static super switch synchronized |
| 36 | +this throw throws transient true try typeof |
| 37 | +var volatile void |
| 38 | +while with |
| 39 | +**************** |
| 40 | +
|
| 41 | +There is no Integer or int data type and hence in JS, 1 is same as 1.0 |
| 42 | +
|
| 43 | +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. |
| 44 | +
|
| 45 | +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. |
| 46 | +
|
| 47 | +"A" === "\u0041" |
| 48 | +Strings have a length property. For example, "seven".length is 5. |
| 49 | +Strings are immutable. Once it is made, a string can never be changed. |
| 50 | +But Strings are easily appended using "+" operator. |
| 51 | +
|
| 52 | +Two strings containing exactly the same characters in the same order are considered to be the same string. So: |
| 53 | + 'c' + 'a' + 't' === 'cat' |
| 54 | +
|
| 55 | +
|
| 56 | +There are usual programming loops in JS, just like in C, C++, Java, Python or any other conventional coding language you might be knowing, |
| 57 | +Same loops and syntax for while, for, do while, switch and others. |
| 58 | +
|
| 59 | +
|
| 60 | +That's it for introduction, let's move on to Objects, in second.js |
| 61 | +
|
| 62 | +*/ |
0 commit comments