So should I always use the ES6 method syntax, even if the old method syntax works?


#1

Question

So should I always use the ES6 method syntax, even if the old method syntax works?

Answer

Yes, the ES6 method syntax is best practice for defining methods nowadays. The JavaScript programming language is constantly evolving though, so it’s good to keep up with what’s new. It’s important to make sure the browser(s) that you are working in or trying to support will support the syntax you are using. In addition, if you are working on a development team at a company, it’s good to check with your team if there is a general standard for coding style to maintain consistency!