Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a78e9d5
Change potentially confusing statement
romanstetsyk Oct 1, 2022
8c256ae
Update article.md
nikolai-chernolutskii Jan 29, 2023
9a90dc1
Fix typo
scottwright-dev Jan 31, 2023
55269bb
Update grammar
gitwinst Mar 2, 2023
c07df98
Update article.md
audiodude Jul 23, 2024
87bfe5b
docs: replace figure brackets with curly braces across all occurrences
swapnasahoo Feb 17, 2026
0354326
Merge branch 'master' into setTimeout
smith558 Feb 25, 2026
c0904ea
Merge pull request #3210 from romanstetsyk/setTimeout
smith558 Feb 25, 2026
b76f5c7
Merge pull request #3347 from scottwright-dev/patch-1
smith558 Feb 25, 2026
c6695ed
Merge pull request #3389 from gitwinst/patch-1
smith558 Feb 25, 2026
f3e09c8
Merge branch 'master' into docs/figure-brackets-to-curly-braces
swapnasahoo Feb 26, 2026
953c2db
Improve coding style
smith558 Feb 26, 2026
7f94b0a
Merge pull request #3936 from swapnasahoo/docs/figure-brackets-to-cur…
smith558 Feb 26, 2026
ff804bc
Merge pull request #3341 from nikolai-chernolutskii/patch-3
smith558 Feb 26, 2026
c6f645c
Merge branch 'master' into patch-1
smith558 Mar 2, 2026
52c1e61
Merge pull request #3724 from audiodude/patch-1
smith558 Mar 2, 2026
a197375
Convert prompt inputs to numbers with unary plus
Lk-ux Jul 4, 2026
f7922ed
Fix Prism API name: highlightElem -> highlightElement
Violet-Bora-Lee Jul 19, 2026
725653f
Merge pull request #3980 from Violet-Bora-Lee/fix-prism-highlight-ele…
iliakan Jul 19, 2026
2020876
Merge pull request #3977 from Lk-ux/patch-3
smith558 Jul 25, 2026
3107e6c
merging all conflicts
iliakan Aug 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions 1-js/01-getting-started/1-intro/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,13 @@ JavaScript-ի հնարավորությունները browser-ում սահման

Սա կոչվում է «Same Origin Policy»։ Երկու էջերն էլ պետք է պայմանավորվեն տվյալների փոխանակման համար և պարունակեն հատուկ JavaScript կոդ, որը կառավարում է դա։ Մենք կխոսենք դրա մասին դասընթացի մեջ։

<<<<<<< HEAD
Այս սահմանափակումը, նույնպես, օգտագործողի ապահովության համար է։ `http://anysite.com`-ից էջը, որը օգտագործողը բացել է, չպետք է հասանելիություն ունենա ուրիշ պատուհանին, օրինակ `http://gmail.com`-ին, ու գողանա տվյալներ։
- JavaScript-ը կարող է հեշտորեն կապվել ցանցով server-ի հետ, որտեղից որ կայքը գալիս է։ Բայց նրա հնարավորությունը, տվյալներ ստանալ այլ աղբյուրներից, սահմանափակ է։ Չնայած, որ հնարավոր է, սակայն այն պահանջում է հատուկ համաձայնություն (արտահայտված HTTP header-ներով) server-ից։ Կրկին, սա արված է օգտագործողի ապահովության համար։
=======
This limitation is, again, for the user's safety. A page from `http://anysite.com` which a user has opened must not be able to access another browser tab with the URL `http://gmail.com`, for example, and steal information from there.
- JavaScript can easily communicate over the net to the server where the current page came from. But its ability to receive data from other sites/domains is severely limited. Though possible, it requires explicit agreement (expressed in HTTP headers) from the remote side. Once again, that's a safety limitation.
>>>>>>> 20208769e528337949e946f526534d61d38bac47

![](limitations.svg)

Expand Down
4 changes: 4 additions & 0 deletions 1-js/02-first-steps/04-variables/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ let userName;
let test123;
```

<<<<<<< HEAD
Երբ փոփոխականի անունը պարունակում է մի քանի բառեր, սովորաբար օգտագործվում է [camelCase](https://en.wikipedia.org/wiki/CamelCase): camelCase-ի օգինակ է հետևյալ անունը՝ `myVeryLongName`:
=======
When the name contains multiple words, [camelCase](https://en.wikipedia.org/wiki/CamelCase) is commonly used. That is: words go one after another, with each word except the first starting with a capital letter: `myVeryLongName`.
>>>>>>> 20208769e528337949e946f526534d61d38bac47

Ինչպես նշեցինք `'$'` և `'_'` նշանները ևս կարող են օգտագործվել փոփոխականների անուններում, սակայն դրանք որոշակի հատուկ իմաստ չունեն:

Expand Down
4 changes: 4 additions & 0 deletions 1-js/02-first-steps/08-operators/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,11 @@ alert( c ); // 4

Կապակցումը կատարվում է աջից դեպի ձախ։ Առաջին կատարվում է ամենաաջակողմյան `2 + 2` արդահայտությունը, ապա վերագրվում է ձախ կողմի փոփոխականին․ `c`, `b` և `a`։ Ամենավերջում, բոլոր փոփոխականները հավաքվում է մեկ արժեքի մեջ։

<<<<<<< HEAD
Կրկին անգամ, ընթերցելիության նկատառումներից ելնելով, լավ է որ այն բաժանված է մի քանի տողերի․
=======
Once again, for the purposes of readability it's better to split such code into a few lines:
>>>>>>> 20208769e528337949e946f526534d61d38bac47

```js
c = 2 + 2;
Expand Down
4 changes: 2 additions & 2 deletions 1-js/02-first-steps/15-function-basics/4-pow/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ function pow(x, n) {
return result;
}

let x = prompt("x?", '');
let n = prompt("n?", '');
let x = +prompt("x?", '');
let n = +prompt("n?", '');

if (n < 1) {
alert(`Power ${n} is not supported, use a positive integer`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ You could note the following:

```js no-beautify
function pow(x,n) // <- no space between arguments
{ // <- figure bracket on a separate line
{ // <- curly brace on a separate line
let result=1; // <- no spaces before or after =
for(let i=0;i<n;i++) {result*=x;} // <- no spaces
// the contents of { ... } should be on a new line
Expand All @@ -13,7 +13,7 @@ function pow(x,n) // <- no space between arguments
let x=prompt("x?",''), n=prompt("n?",'') // <-- technically possible,
// but better make it 2 lines, also there's no spaces and missing ;
if (n<=0) // <- no spaces inside (n <= 0), and should be extra line above it
{ // <- figure bracket on a separate line
{ // <- curly brace on a separate line
// below - long lines can be split into multiple lines for improved readability
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
}
Expand Down
4 changes: 2 additions & 2 deletions 1-js/04-object-basics/01-object/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ As we know from the chapter <info:types>, there are eight data types in JavaScri

In contrast, objects are used to store keyed collections of various data and more complex entities. In JavaScript, objects penetrate almost every aspect of the language. So we must understand them first before going in-depth anywhere else.

An object can be created with figure brackets `{…}` with an optional list of *properties*. A property is a "key: value" pair, where `key` is a string (also called a "property name"), and `value` can be anything.
An object can be created with curly braces `{…}` with an optional list of *properties*. A property is a "key: value" pair, where `key` is a string (also called a "property name"), and `value` can be anything.

We can imagine an object as a cabinet with signed files. Every piece of data is stored in its file by the key. It's easy to find a file by its name or add/remove a file.

Expand All @@ -20,7 +20,7 @@ let user = {}; // "object literal" syntax

![](object-user-empty.svg)

Usually, the figure brackets `{...}` are used. That declaration is called an *object literal*.
Usually, the curly braces `{...}` are used. That declaration is called an *object literal*.

## Literals and properties

Expand Down
2 changes: 1 addition & 1 deletion 1-js/05-data-types/10-destructuring-assignment/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ That works, because internally a destructuring assignment works by iterating ove
````


````smart header="Assign to anything at the left-side"
````smart header="Assign to anything on the left-side"
We can use any "assignables" on the left side.

For instance, an object property:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ And here is the picture for the nested `setTimeout`:

![](settimeout-interval.svg)

**The nested `setTimeout` guarantees the fixed delay (here 100ms).**
**The nested `setTimeout` ensures a minimum delay (100ms here) between the end of one call and the beginning of the subsequent one.**

That's because a new call is planned at the end of the previous one.

Expand Down
12 changes: 6 additions & 6 deletions 2-ui/99-ui-misc/01-mutation-observer/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ Such snippet in an HTML markup looks like this:
...
```

For better readability and at the same time, to beautify it, we'll be using a JavaScript syntax highlighting library on our site, like [Prism.js](https://prismjs.com/). To get syntax highlighting for above snippet in Prism, `Prism.highlightElem(pre)` is called, which examines the contents of such `pre` elements and adds special tags and styles for colored syntax highlighting into those elements, similar to what you see in examples here, on this page.
For better readability and at the same time, to beautify it, we'll be using a JavaScript syntax highlighting library on our site, like [Prism.js](https://prismjs.com/). To get syntax highlighting for above snippet in Prism, `Prism.highlightElement(pre)` is called, which examines the contents of such `pre` elements and adds special tags and styles for colored syntax highlighting into those elements, similar to what you see in examples here, on this page.

When exactly should we run that highlighting method? Well, we can do it on `DOMContentLoaded` event, or put the script at the bottom of the page. The moment our DOM is ready, we can search for elements `pre[class*="language"]` and call `Prism.highlightElem` on them:
When exactly should we run that highlighting method? Well, we can do it on `DOMContentLoaded` event, or put the script at the bottom of the page. The moment our DOM is ready, we can search for elements `pre[class*="language"]` and call `Prism.highlightElement` on them:

```js
// highlight all code snippets on the page
document.querySelectorAll('pre[class*="language"]').forEach(Prism.highlightElem);
document.querySelectorAll('pre[class*="language"]').forEach(elem => Prism.highlightElement(elem));
```

Everything's simple so far, right? We find code snippets in HTML and highlight them.
Expand All @@ -146,9 +146,9 @@ let article = /* fetch new content from server */
articleElem.innerHTML = article;
```

The new `article` HTML may contain code snippets. We need to call `Prism.highlightElem` on them, otherwise they won't get highlighted.
The new `article` HTML may contain code snippets. We need to call `Prism.highlightElement` on them, otherwise they won't get highlighted.

**Where and when to call `Prism.highlightElem` for a dynamically loaded article?**
**Where and when to call `Prism.highlightElement` for a dynamically loaded article?**

We could append that call to the code that loads an article, like this:

Expand All @@ -158,7 +158,7 @@ articleElem.innerHTML = article;

*!*
let snippets = articleElem.querySelectorAll('pre[class*="language-"]');
snippets.forEach(Prism.highlightElem);
snippets.forEach(elem => Prism.highlightElement(elem));
*/!*
```

Expand Down