Is the javascript c keyword really deprecated?

Using JavaScript operators withhas long been considered bad coding practice and has been recommended against.

This page indicates that it is withoutdated and will cause an error in strict mode, my browser displays an error message when used within strict mode, and the Google Closure compiler generates an error indicating that strict mode does not allow with:

JSC_USE_OF_WITH: The with statement cannot be used in strict mode.

According to MDN , it is recommended that you avoid using it with, but today it seems to be practically not recommended , and it does not seem to be included in the examples of strict mode code restrictions .

This looks somewhat controversial and confusing. So, is it withreally outdated or not?

+2
source share
1 answer

This official position of TC39 (the guys who publish the ECMAScript specification) is insightful:

Why don't we blame functions?

Fatigue does not work on the Internet. Since it cannot remove bad functions , the developer has little incentive to stop using the function just because someone does not like it. The marking function is "out of date" without deleting them, meaningless.

http://tc39wiki.calculist.org/about/faq/#deprecate

, , , ECMAScript; , with , , (.. ) , / .

+5

Source: https://habr.com/ru/post/1693714/


All Articles