Stuck on "Use Destructuring Assignment to Assign Variables from Objects"

Tell us what’s happening:
Hi friends,
I’m stuck here I need help please.
Here is the challenge link:
I completely don’t understand though, I got everything right (according to the researches I did).
I won’t be surprise if it’s just some bugs or things like that.

Thanks in advance!

Your code so far

function getLength(str) {
  "use strict";

  // change code below this line
  var length = {x: str.length};
  const {x: len} = length;
  // change code above this line

  return len; // you must assign length to len in line



Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0.

Link to the challenge:

I managed to fix it.
Some hints:

  • 1) Make sure str does have a property named "length" which obviously contain the length of the given string
  • 2) Assign the "length" property to a local variable named "len" using destructuring assignment in 1line which is the "get the field x and copy the value into a" method
  • Keep this in mind and everything will be alright