# I dot understand this question I am stuck

I dot understand this question I am stuck
0

#1

Tell us what’s happening:

``````
function getLength(str) {
"use strict";

// change code below this line
const length = 0; // change this
// change code above this line

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

}

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

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0.3 Safari/604.5.6`.

#2

What do you not understand about it?

What have you have tried?

#3

I understand how we can destructure the object and arrays but confused how we can destructure object, if we are using the function.

#4

var voxel = {x: 3.6, y: 7.4, z: 6.54 };
var x = voxel.x; // x = 3.6
var y = voxel.y; // y = 7.4
var z = voxel.z; // z = 6.54
Here’s the same assignment statement with ES6 destructuring syntax:

const { x, y, z } = voxel; // x = 3.6, y = 7.4, z = 6.54
If instead you want to store the values of voxel.x into a, voxel.y into b, and voxel.z into c, you have that freedom as well.

const { x : a, y : b, z : c } = voxel // a = 3.6, b = 7.4, c = 6.54

Till here I understand.

#5

Think of str as an object. You know that Strings have a length property, so use that to your advantage.

#6

Strings have prototype methods built in called length.

You are simply assigning length into a new variable called len.

`const { x : a, y : b, z : c } = voxel // a = 3.6, b = 7.4, c = 6.54`

Use this as an example.

#7
``````function getLength(str) {
"use strict";

// change code below this line
const length = 0; // change this
// change code above this line

const len= str.length; // you must assign length to len in line

}

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

don’t understand.

#8

`var str = {length:...}`

Then what should go in here?

`````` const length = 0; // change this
``````

Hint: Use deconstruction using const here.

#9

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (`</>`) will also add backticks around text.

Note: Backticks are not single quotes.

#10

Thank you so much I will try to do that.

#11

Can I give any length?

#12

No, I just gave my above reply as an example.

Can you try now?

#13

I got the solution but I don’t understand the concept it’s very confusing.