mm·2023년 4월 20일

react theo

트위터 리액트 개발자?
https://www.youtube.com/watch?v=M4CLvtCS2YU
Array.prototype.flat()
Array.prototype.find()

const array1 = [5, 12, 8, 130, 44];
const found = array1.find(element => element > 10);
const arr1 = [0, 1, 2, [3, 4]];

console.log(arr1.flat());
// Expected output: Array [0, 1, 2, 3, 4]

const arr2 = [0, 1, 2, [[[3, 4]]]];

console.log(arr2.flat(2));
// Expected output: Array [0, 1, 2, Array [3, 4]]

https://lodash.com/docs/4.17.15#flatten

profile
velog 이것 저것

0개의 댓글