Help!Use Destructuring Assignment to Assign Variables from Objects

Tell us what’s happening:

Your code so far


function getLength(str) {
  "use strict";

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

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

}

console.log(getLength('FreeCodeCamp'));

Error: // running test
destructuring with reassignment was used
// tests completed

How is it fix?

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects

It’s OK. One line :roll_eyes:

Can you please upload the solution to this… I’m still struggling to get it. Thanks :slight_smile: