Skip to content

Commit

Permalink
Готовая секция 10 basics (#121)
Browse files Browse the repository at this point in the history
* hello-world en version added 1st draft

* moved description.en.yml file

* deleted description file from git control

* fixed hello-world en virsion

* fixed grammar

* fixed typos #1

* comments section en version #1

*  comments section en version-hexlet-basics#2

* 40 instractions eng version

* fixed vulnerability

* 45 testing eng virsion 1 draft

* fixing issues #1

* fixing issues after linting #1

* fixing issues after linting #2

* fixing typo

* 45-testing added eng version

* added eng version of description

* 10-basics/50-syntax-errors fixing typo #1

* 10-basics/45-testing fixing typo

* YAML is valid now

* fixed typos

* fixed typos

* fixed YAML errors
  • Loading branch information
enceladus181 authored and mokevnin committed Jul 29, 2019
1 parent 3e461d3 commit 04a6955
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 5 deletions.
6 changes: 2 additions & 4 deletions modules/10-basics/40-instructions/description.en.yml
Expand Up @@ -48,9 +48,7 @@ instructions: |
definitions:
- name: interpreter
description: |
A program executing code in JavaScript
A program executing code in JavaScript
- name: Statement
description: |
a command given to computer. PHP code is a set of instructions separated (most frequently) by `;`.

A command given to computer. JavaScript code is a set of instructions separated (most frequently) by `;`.
19 changes: 18 additions & 1 deletion modules/10-basics/45-testing/description.en.yml
Expand Up @@ -2,6 +2,7 @@

name: How do we verify solutions?
theory: |
Our website verifies your solutions automatically. You may wonder how it works.
In the simplest case the system runs your code and analyzes the screen output. Then it compares the actual output against the expected output.
Expand All @@ -10,18 +11,34 @@ theory: |
Let's assume your task is to program a function that adds two numbers. The verification system would give it several combinations of numbers and compare your function's answers with correctly calculated ones. If all actual values match the expected ones, your solution would be considered valid.
This approach is named testing. It is used extensively in the real life day-to-day development process. Developers usually write tests _first_, and only after proceed to writing the program itself. During that process he runs tests multiple time to check how close he got to the desired solution.
This approach is named testing. It is used extensively in the real life day-to-day development process. A developer usually writes tests _first_, and only after proceeds to writing the program itself. During that process he runs tests multiple times to check how close he/she got to the desired solution.
That is why our website says “Tests passed” once you solved the task correctly.
One of your tasks in the following lessons will be to write a function that performs certain calculations and returns the result. As an example, let's assume you made a small mistake and the function returned a wrong value. In that case, the system will give you the following message:
<pre class='hexlet-basics-output'>
● test
expect(received).toBe(expected) // Object.is equality
Expected value to be:
"Hello, World!"
Received:
"ello, World!"
</pre>
In addition to our tests, it's very useful to experement with code in the console [of a browser](https://developer.mozilla.org/ru/docs/Tools/%D0%9A%D0%BE%D0%BD%D1%81%D0%BE%D0%BB%D1%8C_%D0%B1%D1%80%D0%B0%D1%83%D0%B7%D0%B5%D1%80%D0%B0). In a situation when something isn't clear for you or you want to experiment with code, feel free to do all of this in the console. Ideally, it's best to execute all the code given in the lessons on your own. In addition to console it's also helpful to use the following service [repl.it](https://repl.it/languages/javascript).
instructions: |
Display the following number: `9780262531962`.
definitions:
- name: Tests
description: |
code designed to check if a program works correctly; it does so by comparing a set of known valid results against the actual output of the program.
tips:
- |
[jest](http://jestjs.io/)
- |
[TDD](https://ru.wikipedia.org/wiki/Разработка_через_тестирование)
33 changes: 33 additions & 0 deletions modules/10-basics/50-syntax-errors/description.en.yml
@@ -0,0 +1,33 @@
---

name: Syntax errors
theory: |
If a JavaScript program isn't syntactically correct, interpreter will show a relevant message and a note with a file and line where an error might have occured. **Syntax errors** occur when the code has grammar mistakes. Grammar rules are important in human languages but the lack of it won't affect your ability to read or understand any text. But in programming everything should be strict. Even a tiny violation and your program will not run. A wrong parenthesis order, a `;` that you forgot to add — these are just some examples of such violations.
Here is an example of code with a syntax error:
```javascript
console.log('Hodor'
```
If we run this code we will see the following message: `SyntaxError: missing ) after argument list`. In JavaScript such errors are called "SyntaxError". As we can see it includes a file path and a line number.
On one hand, syntax errors are the simplest because they are all about code grammar rules and aren't related to any code logic. They can be easily fixed, you just need to find them.
On the other hand, interpreter will not always tell you the correct position of an error. Sometimes you need to add a forgotten bracket to another place as opposed to what the error message says.
instructions: |
This task isn't related to the lesson directly but it would be useful to practice displaying content on the screen anyway.
Display following text `What Is Dead May Never Die`.
tips:
- |
[JavaScript errors](https://habr.com/ru/post/249525/)
definitions:
- name: "Syntax error"
description: "violation of grammar rules in a programming language"
- name: "SyntaxError (Parse error)"
description: "type of errors in JavaScript, which occur when there are syntax errors in the code"

0 comments on commit 04a6955

Please sign in to comment.