+ 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?
10 Answers
+ 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;
+ 6
obsolete feature, don't use it, like eval
+ 4
i dont understand your question.illd like to help
+ 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
+ 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
+ 1
you need explore more
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
0
BrainsđłđŹ ooo Iâll look into that!
0
JavaScript software company IT PROGRAMMNG