r/learnjavascript • • Oct 11 '20

JavaScript can keep you safe

Post image
1.0k Upvotes

87 comments sorted by

View all comments

40

u/[deleted] Oct 11 '20

Now wearing one million masks and counting.

Also

snake_case & CapitalCase combined? Wtf

2

u/DrKrepz Oct 11 '20

I like using the former for variable declarations and the latter for functions/methods. Having said that, since I started using Vue a lot it's pretty much all CamelCase, mainly because it feels like the lines between the two have blurred a bit with computed data and props etc.

1

u/[deleted] Oct 11 '20

Vue and React classes are Capital Case but you don't invoke them like that

2

u/DrKrepz Oct 11 '20

Well it depends on how you're invoking them, in Vue at least. Still, in vanilla js there is still a good case for using different naming conventions for different contexts.

1

u/ThagAnderson helpful Oct 13 '20

Best practice states that classes and non-ES6 constructor functions should always begin with a capital letter. Nothing to do with Vue or React. The code in the picture would not pass any Javascript styling conventions.