Ask about the function of a JS function.

function get(arr) {
  return arr.map(
      Function.prototype.call,
      String.prototype.trim
  )
}
// map
console.log(get(["a b", "u 2 1"]));
What does the above code mean? Ask for a detailed explanation

Jan.08,2022

  

for each object in arr, trim is called as the context of call, and the final effect is equivalent to calling the trim method of each object

.
Menu