|
|
|
@ -3,22 +3,18 @@
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
Create a `verydisco-reverso.mjs` script that: |
|
|
|
|
- takes the name of a file (with extension) in argument |
|
|
|
|
- read this file |
|
|
|
|
- discover the content of this file by reversing it from the `very disco` mode |
|
|
|
|
- print the result in console |
|
|
|
|
|
|
|
|
|
- takes the name of a file (with the extension) as a first argument |
|
|
|
|
- reads this file |
|
|
|
|
- deciphers the content of this file by reversing it from the `very disco` mode |
|
|
|
|
- prints the result in the console |
|
|
|
|
|
|
|
|
|
For example: |
|
|
|
|
|
|
|
|
|
- Reading the `verydisco` content of your `verydisco.txt` file would print `discovery` in console. |
|
|
|
|
|
|
|
|
|
### Notions |
|
|
|
|
|
|
|
|
|
- [Node file system: `readFile`](https://nodejs.org/api/fs.html#fs_fspromises_writefile_file_data_options) |
|
|
|
|
- [Node file system: `readFile`](https://nodejs.org/api/fs.html#fs_fspromises_readfile_path_options) |
|
|
|
|
- [try...catch](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch) |
|
|
|
|
- [`Math.floor()` function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor) |
|
|
|
|
<!-- |
|
|
|
|
again? |
|
|
|
|
- [Node path: `resolve`](https://nodejs.org/api/path.html#path_path_resolve_paths) |
|
|
|
|
- [Node path: `join`](https://nodejs.org/api/path.html#path_path_join_paths) |
|
|
|
|
--> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|