“JavaScript Manipulasi Data Lanjutan” Kode Jawaban

JavaScript Manipulasi Data Lanjutan

var flattenedArray = [];var coloursArray = [ [“blue”, “green”], [“green”, “black”, “orange”, “blue”], [“green”, “red”] ]flattenedArray = coloursArray.reduce( (total, subArray)=>{ return total.concat(subArray)},[]);console.log(flattenedArray)["blue", "green", "green", "black", "orange", "blue", "green", "red"]
Ugly Unicorn

JavaScript Manipulasi Data Lanjutan

var array = [“blue”, “green”, “green”, “black”, “orange”, “blue”, “green”, “red”];var uniqueArray = [];uniqueArray = array.filter((element, index, array)=>{ return array.indexOf(element) === index;})console.log(uniqueArray)["blue", "green", "black", "orange", "red"]
Ugly Unicorn

Jawaban yang mirip dengan “JavaScript Manipulasi Data Lanjutan”

Pertanyaan yang mirip dengan “JavaScript Manipulasi Data Lanjutan”

Lebih banyak jawaban terkait untuk “JavaScript Manipulasi Data Lanjutan” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya