js join a list of items with a number
const elements = ['Fire', 'Air', 'Water'];
console.log(elements.join());
// expected output: "Fire,Air,Water"
console.log(elements.join(''));
// expected output: "FireAirWater"
console.log(elements.join('-'));
// expected output: "Fire-Air-Water"const winners = ["George", "Tim", "John"];
const orderedList = winners.map((w, i) => `${i + 1}. ${w}`);
console.log(order.join("\n"));
// expected output:
// 1. George
// 2. Tim
// 3. John
Also in JavaScript:
- js get time in am
- get last element in array in javascript
- react native shadow android
- setting up a sprite sheet in js
- settimout jquery
- Javascript remove array item by value
- js array
- javascript get clock time in auto counter up
- how to get MAC id of nodemcu
- react props.children proptype
- ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ngIf: [object Object]'. Current value: 'ngIf: true'.
- how to remove an item from an array in javascript
- jest async test fetch api
- Hide elements until Alpine Js loads
- javascript date get current date
- how to make an object in p5 go right to left with keycCicked p5
- javascript remove item onclick
- usematch react router
- how to change css with js
- dynamodb get all items nodejs
- jquery function
- javascript get all select options
- javascript loop through array backwords
- angular add bootstrap