## DEV Community 👩‍💻👨‍💻 is a community of 963,503 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Youssef Rabei

Posted on

# Testing 1-2-3 : ✍ by acr

### 📃 Description

Write a function which takes a list of strings and returns each line prepended by the correct number.

#### Examples:

``````number([]) // => []
number(["a", "b", "c"]) // => ["1: a", "2: b", "3: c"]
``````

### 🤔 Thinking

`map` over the array and return an array using template literal every element with its `index`

### 👨‍💻 Code

``````const number = arr => arr.map((elm, i) => `\${i+1}: \${elm}`)
``````

# Stop gninnipS My sdroW! : ✍ by xDranik

### 📃 Description

Write a function that takes in a string of one or more words, and returns the same string, but with `all five or more letter words reversed` (Just like the name of this Kata). Strings passed in will consist of only letters and spaces. Spaces will be included only when more than one word is present.

#### Examples:

``````spinWords( "Hey fellow warriors" ) // => "Hey wollef sroirraw"
spinWords( "This is a test") // =>"This is a test"
spinWords( "This is another test" ) // =>"This is rehtona test"
``````

### 🤔 Thinking

Turn the string into an `array` of words (strings)
Then Check if the word length >= 5
If `true` I will `reverse` the word(s)
Then `join` it all

### 👨‍💻 Code

``````const spinWords = str => {
const arr = str.split(" ");
const spinedarr = arr.map(word => {
return word.length >= 5 ? word.split("").reverse().join("") : word;
})

return spinedarr.join(" ");
}
``````

# Credit Card Mask : ✍ by samranjbari

### 📃 Description

Write a function maskify, which changes all but the last four characters into '#'.

#### Examples:

``````maskify("4556364607935616") // => "############5616"
``````

### 🤔 Thinking

I'm will make an `array` and then `slice` it so I get the last 4 digits
Then use the `padStart` method to create a string with the same length with that starts with `#`s

### 🤷‍♂️ What?

#### MDN:

The `padStart()` method pads the current string with another string (multiple times, if needed) until the resulting string reaches the given length. The padding is applied from the start of the current string.

### 👨‍💻 Code

``````const maskify = cc => {
const last4 = cc.split("").slice(-4);

}
``````

##### If you know a better way to solve any of the previous katas let me know in the comment

Thanks for reading, I really appreciate it.

Tao Christopher Takahashi

You're doing great!!!
Just one note tho.
When creating a function or a method that takes in param/props the name should be more clear and specific for better readability. when you have time you should check The Art Of Readable Code. It will 1up your game for sure!

Classic DEV Post from 2020:

## 🚀⚙️ JavaScript Visualized: the JavaScript Engine

As JavaScript devs, we usually don't have to deal with compilers ourselves. However, it's definitely good to know the basics of the JavaScript engine and see how it handles our human-friendly JS code, and turns it into something machines understand! 🥳

Happy coding!