Answers for ".map method in js"

3

map in javascript

['elem', 'another', 'name'].map((value, index, originalArray) => { 
  console.log(.....)
});
Posted by: Guest on April-27-2020
-2

.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 "Javascript"

Browse Popular Code Answers by Language