Help!Use Destructuring Assignment to Assign Variables from Objects

Help!Use Destructuring Assignment to Assign Variables from Objects
0.0 0

#1

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


#2

It’s OK. One line :roll_eyes: