Use Destructuring Assignment to Assign Variables from Objects challenge

Tell us what’s happening:

Hello, I need help to pass this challenge.

Your code so far

function getLength(str) {
  "use strict";

  // change code below this line
  var length = {x: str.length}; // change this
  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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36.

Link to the challenge:

First of all, only change the following original line. Do not add anything above this line or below this line.

const length = 0; // change this

Second, see if the following template helps you to better understand how to write the syntax:

const {objPropName: newVariableName} = objName;

Thank you so much, I undertand now.