In js... Deconstruction assignment of expression

go directly to the code

function Person (a, b) {
  this.a = a;
  this.b = b;
  
  this.get = (name) => {
      return this[name]
  }
}

let obj = {
  a: 1,
  b: 2,
  c: 3,
}
let obj2 = new Person(11, 22)
let url = new URL("https://jsfiddle.net")

console.log({...obj})
console.log("==================")
console.log(obj2)
console.log({...obj2})
console.log("==================")
console.log(url)
console.log({...url})

the result is:

clipboard.png

question:
Why is the result of console.log ({... url}) an empty object?

Jul.07,2022

https://developer.mozilla.org...
take a look at


. applies only to iterable objects. New URL () is not an iterable object

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e0f8-2bb5e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e0f8-2bb5e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?