You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.3 KiB

## verydisco
### Instructions
Create a `verydisco.mjs` script that :
4 years ago
- takes the 1st argument from the command line (after the program name)
- makes it very disco:
4 years ago
- cut each word from this argument in 2 (rounded up),
- re-compose a word by concatenating the chunks in the other order
- display the result in console
4 years ago
If the argument passed is a sentence, each word of the sentence must be "very disco".
For example:
4 years ago
- `discovery` would print `verydisco` (🕺🏼) in console.
4 years ago
- `Node is awesome` would print `deNo si omeawes` in the console.
### Notions
- [Node process: `argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv)
- [nan-academy.github.io/js-training/examples/methods.js](https://github.com/nan-academy/js-training/blob/master/examples/methods.js)
- [`slice()` method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice)
- [`includes()` method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes)
- [`split()` method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split)
- [`join()` method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join)
- [`Math.ceil()` function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil)