Answers for "how to create an element in js using the map method"

6

how to create an element in js using the map method

const numbers = [1, 2, 3, 4, 5]; 

const bigNumbers = numbers.map(number => {
  return number * 10;
});
Posted by: Guest on April-08-2020
-1

.map in js

// A function which returns the last character of a given string
function returnLast(arr) {
  return arr.at(-1);
}

let invoiceRef = 'myinvoice01';

console.log( returnLast(invoiceRef) );
// Logs: '1'

invoiceRef = 'myinvoice02';

console.log( returnLast(invoiceRef) );
// Logs: '2'
Posted by: Guest on June-04-2021

Code answers related to "how to create an element in js using the map method"

Code answers related to "Javascript"

Browse Popular Code Answers by Language