0.0 0


Tell us what’s happening:

what is the mistake i have done in this coding ?? its not working help me

Your code so far

function getLength(str) {
  "use strict";

  // change code below this line
const len = str.length; 
  // change this
  // 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; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0.

Link to the challenge:


You’re not using ‘destructuring’ ^^
I know you can assign the length of the string in an easy way as you did, but that’s not the assignment :stuck_out_tongue:
Try to read again the instruction (especially this example: const { x : a, y : b, z : c } = voxel ) then i’m pretty sure you will figure it out ^^

Hope it helps,


I don’t get it. The entire destructing thing is just confusing. Why ever do this rather than what @ravi6112 did


I had trouble thinking about this too, but helps to think of the string length as a property of the string object.

const stringObj = { key: value, key2:value, length:num}

The destructuring syntax refers to the object’s key (in this case to find the Length property) on the left side of the colon, and puts that in the new variable we want to create on the right of the colon (const len).


function getLength(str) {
“use strict”;

const {length: len} = str;

return len;



In this way you declare variable len as function for strings “length” and assign the value of str.length to len