This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //correct test for https://ru.hexlet.io/courses/js-advanced-testing/lessons/files/exercise_unit task | |
| import os from 'os'; | |
| import path from 'path'; | |
| import { promises as fs } from 'fs'; | |
| import getFunction from '../functions.js'; | |
| const prettifyHTMLFile = getFunction(); | |
| // BEGIN (write your solution here) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const canvas = document.querySelector('canvas'); | |
| const downloadLink = document.querySelector('.download-link'); | |
| downloadLink.addEventListener('click', (e) => e.target.href = canvas.toDataURL()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wsl.exe --shutdown |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * `Maybe` type allows us to type annotate a potentially `null` or `undefined` value. | |
| * They have the type `T|void|null` for some type `T`, meaning it is either type `T` or it is `undefined` or `null`. | |
| */ | |
| var message: ?string = null; //here I’m saying that message is either a `string`, or it’s `null` or `undefined` | |
| /** | |
| * You can also use maybe to indicate that an object property will be either of some type `T` or `undefined`. | |
| * | |
| * By putting the `?` next to the property name for `middleInitial`, you can indicate that this field is optional. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type GenericObject<T> = { key: T }; | |
| var numberT: GenericObject<number> = { key: 123 }; | |
| var stringT: GenericObject<string> = { key: "Preethi" }; | |
| var arrayT: GenericObject<Array<number>> = { key: [1, 2, 3] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type PaymentMethod = { | |
| id: number, | |
| name: string, | |
| limit: number, | |
| }; | |
| var myPaypal: PaymentMethod = { | |
| id: 123456, | |
| name: 'Preethi Paypal', | |
| limit: 10000, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var isFetching: boolean = false; | |
| var luckyNumber: number = 10; | |
| var notSoLuckyNumber: number = NaN; | |
| var myName: string = 'Artem'; | |
| var dataNull: null = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ReactComponent as Logo } from './logo.svg'; | |
| function App() { | |
| return ( | |
| <div> | |
| <Logo title="logo"/> | |
| </div> | |
| ); | |
| } | |
| /* Tip: The imported SVG React Component accepts a title prop along with other props that a svg element accepts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npx create-react-app my-app --use-npm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" | |
| content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| </head> | |
| <body> |