What's missing?

What's missing?
0.0 0

#1

I am not getting solution

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

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


#2

Right side have to contain just name of an object that inludes required property without the property name.
For example:

const obj = {apples: 10};
const {apples: eat} = obj;
console.log(eat);// 10


#3

even your logic doesnt work

const length = {x:str.length}; // change this
const {x:len} = length;


#4

Ok. Here is construction.
const {} = obj;
You declare const first and then you assign the obj to it.
Second step.
Within your const object on the left side you have to use next syntax:
const { x : y } where x is the property of the existing object and y is a name of your own variable.
Well we have next syntax:
const { x : y } = obj;


#5

thats what i have done.


#6

still its not working


#7

This is your code:

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

Try to change str.length to str


#8

like this…doesnt work
var str =str.length + 0;
const {length:len} =str;


#9

Why are you doing it? Delete this line and try again.


#10

works…but how??? whr that lenth gets calculated??


#11

We did it bro. Congrats.

Now about length.
Every string in JavaScript has its own property like length.

I suggest you to read next articles:

  1. MDN: Objects
    2.W3C: String
    3.W3C: String Property - length

You have to understand what is the string in JS.
WTG! Keep going.


#12

thanks mate. what do you do btw?