Skip to content

Commit d0b0a4a

Browse files
authored
Merge pull request #1 from javascript-tutorial/master
Update master
2 parents 09f2aa6 + 438e66d commit d0b0a4a

File tree

98 files changed

+164
-156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+164
-156
lines changed

1-js/01-getting-started/4-devtools/article.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ The exact look of developer tools depends on your version of Chrome. It changes
2929
- Here we can see the red-colored error message. In this case, the script contains an unknown "lalala" command.
3030
- On the right, there is a clickable link to the source `bug.html:12` with the line number where the error has occurred.
3131

32-
Below the error message, there is a blue `>` symbol. It marks a "command line" where we can type JavaScript commands. Press `key:Enter` to run them (`key:Shift+Enter` to input multi-line commands).
32+
Below the error message, there is a blue `>` symbol. It marks a "command line" where we can type JavaScript commands. Press `key:Enter` to run them.
3333

3434
Now we can see errors, and that's enough for a start. We'll come back to developer tools later and cover debugging more in-depth in the chapter <info:debugging-chrome>.
3535

36+
```smart header="Multi-line input"
37+
Usually, when we put a line of code into the console, and then press `key:Enter`, it executes.
38+
39+
To insert multiple lines, press `key:Shift+Enter`. This way one can enter long fragments of JavaScript code.
40+
```
3641

3742
## Firefox, Edge, and others
3843

@@ -50,12 +55,6 @@ Open Preferences and go to the "Advanced" pane. There's a checkbox at the bottom
5055

5156
Now `key:Cmd+Opt+C` can toggle the console. Also, note that the new top menu item named "Develop" has appeared. It has many commands and options.
5257

53-
```smart header="Multi-line input"
54-
Usually, when we put a line of code into the console, and then press `key:Enter`, it executes.
55-
56-
To insert multiple lines, press `key:Shift+Enter`. This way one can enter long fragments of JavaScript code.
57-
```
58-
5958
## Summary
6059

6160
- Developer tools allow us to see errors, run commands, examine variables, and much more.

1-js/02-first-steps/05-types/article.md

+28-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ message = 123456;
1010

1111
Programming languages that allow such things are called "dynamically typed", meaning that there are data types, but variables are not bound to any of them.
1212

13-
There are seven basic data types in JavaScript. Here, we'll cover them in general and in the next chapters we'll talk about each of them in detail.
13+
There are eight basic data types in JavaScript. Here, we'll cover them in general and in the next chapters we'll talk about each of them in detail.
1414

1515
## A number
1616

@@ -180,6 +180,31 @@ All other types are called "primitive" because their values can contain only a s
180180

181181
The `symbol` type is used to create unique identifiers for objects. We mention it here for completeness, but we'll study it after objects.
182182

183+
## BigInt
184+
185+
In JavaScript, the Number type cannot represent integer values larger than 2<sup>53</sup>-1. This limitation has forced many of us to use inefficient workarounds. BigInt is a new data type intended to fix just that. A BigInt is created by appending n to the end of an integer literal — 10n — or by calling the function BigInt().
186+
187+
```js run
188+
const theBiggestInt = 9007199254740991n;
189+
190+
const huge = BigInt(9007199254740991);
191+
192+
alert(typeof biggestInt); // shows "bigint"
193+
194+
alert(typeof huge); // shows "bigint"
195+
```
196+
Bigint can mostly be used like number but there are some key differences
197+
- Most math operatioons work on it normally
198+
- It cannot be mixed and match with number while apllying binary operations it has to be coerced into each other but be careful it can lead to some precision losses
199+
- The / operator also works as expected with whole numbers. However, since these are BigInts and not BigDecimals, this operation will round towards 0, which is to say, it will not return any fractional digits.
200+
201+
To know more in detail about the java script newest addition in prmitive types please visit [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) docs for it
202+
203+
204+
```smart header="Compatability issues"
205+
Right now it only compatible with firefox and chrome but is not supported in Safari.
206+
```
207+
183208
## The typeof operator [#type-typeof]
184209

185210
The `typeof` operator returns the type of the argument. It's useful when we want to process values of different types differently or just want to do a quick check.
@@ -226,7 +251,7 @@ The last three lines may need additional explanation:
226251

227252
## Summary
228253

229-
There are 7 basic data types in JavaScript.
254+
There are 8 basic data types in JavaScript.
230255

231256
- `number` for numbers of any kind: integer or floating-point.
232257
- `string` for strings. A string may have one or more characters, there's no separate single-character type.
@@ -235,6 +260,7 @@ There are 7 basic data types in JavaScript.
235260
- `undefined` for unassigned values -- a standalone type that has a single value `undefined`.
236261
- `object` for more complex data structures.
237262
- `symbol` for unique identifiers.
263+
- `bigint` is for displaying numbers greater than 2<sup>53</sup>-1
238264

239265
The `typeof` operator allows us to see which type is stored in a variable.
240266

Loading

1-js/03-code-quality/01-debugging-chrome/chrome-open-sources.svg

+1-1
Loading

1-js/03-code-quality/01-debugging-chrome/chrome-sources-breakpoint.svg

+1-1
Loading

1-js/03-code-quality/01-debugging-chrome/chrome-sources-debugger-trace-1.svg

+1-1
Loading

1-js/03-code-quality/02-coding-style/code-style.svg

+1-1
Loading

1-js/03-code-quality/06-polyfills/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Here Babel comes to the rescue.
1919

2020
Actually, there are two parts in Babel:
2121

22-
1. First, the transpiler program, which rewrites the code. The developer runs it on their own computer. It rewrites the code into the older standard. And then the code is delivered to the website for users. Modern project build systems like [webpack](http://webpack.github.io/) provide means to run transpiler automatically on every code change, so that very easy to integrate into development process.
22+
1. First, the transpiler program, which rewrites the code. The developer runs it on their own computer. It rewrites the code into the older standard. And then the code is delivered to the website for users. Modern project build systems like [webpack](http://webpack.github.io/) provide means to run transpiler automatically on every code change, so that it's very easy to integrate into development process.
2323

2424
2. Second, the polyfill.
2525

0 commit comments

Comments
 (0)