+ 3

What is JavaScript with(o)?

I saw use of a keyword with taking one param in a function, but even documentation on it seems kinda hard to understand. It seems to change scope of an existing variable? Anyone want to give a better explanation?

1st Jul 2018, 9:11 PM
nk361
nk361 - avatar
10 odpowiedzi
+ 7
oh the with statement its a bad thing dont try using it,it digs into an object for its properties.its deprecated. es6 introduces object destructuring for that. const {PI}=Math;
1st Jul 2018, 9:28 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 6
obsolete feature, don't use it, like eval
1st Jul 2018, 9:24 PM
\__(° = °)__/
+ 4
i dont understand your question.illd like to help
1st Jul 2018, 9:22 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 2
with statement was born for make access to complex/long variable (lexically) in easy way but now its deprecated because add more problems than it remove... Dont use it at all
1st Jul 2018, 10:14 PM
KrOW
KrOW - avatar
+ 1
KrOW it looks like it acts like c++’s using when it comes to the JavaScript Math library, but I don’t completely see what it’s doing with the two param function
1st Jul 2018, 9:17 PM
nk361
nk361 - avatar
+ 1
you need explore more
7th Sep 2018, 5:03 PM
Rahul
Rahul - avatar
0
Brains🇳🇬 KrOW gave a link to it’s documentation here, it shows it in use, but it only makes sense to me when it makes it so you don’t have to call Math. before every use of PI. I don’t really understand the normal variable stuff with it
1st Jul 2018, 9:25 PM
nk361
nk361 - avatar
0
Brains🇳🇬 ooo I’ll look into that!
1st Jul 2018, 9:30 PM
nk361
nk361 - avatar
0
JavaScript software company IT PROGRAMMNG
30th Aug 2018, 4:28 PM
Anuu Pali
Anuu Pali - avatar