JS Lab 1 - nativeMap

In this example below you will see how to do a JS Lab 1 - nativeMap with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by Argeento, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright Argeento ©
  • HTML
  • CSS
  • JavaScript
    

/*Downloaded from https://www.codeseek.co/Argeento/js-lab-1-nativemap-XgrgVg */
    


/*Downloaded from https://www.codeseek.co/Argeento/js-lab-1-nativemap-XgrgVg */
    // Zadanie polega na zaimplementowaniu poniższej funkcji
// nie użwyając przy tym higher order functions

function nativeMap(arr, fn) {
	return arr.map(fn)
}

// -------------------------------

function es5map(arr, fn) {
	// code
}

function es6map(arr, fn) {
	// code
}

// -------------------------------


// przykłady z nativeMap

// const numbers = [1, 2, 3]
// nativeMap(numbers, (number, index, arr) => {
// 	return number + index + arr.length
// }) // [4, 6, 8]

// es6map(numbers, (number, index, arr) => {
// 	return number + index + arr.length
// })

// const people = [
// 	{ name: 'Foo', age: 20 },
// 	{ name: 'Bar', age: 22 }
// ]
// const x = nativeMap(people, person => person.name ) // ['Foo', 'Bar']


Comments