User:Guest-1052/coding: Difference between revisions
Appearance
Guest-1052 (talk | contribs) add Milk.JS release |
Guest-1052 (talk | contribs) No edit summary |
||
| Line 25: | Line 25: | ||
}; | }; | ||
setTimeout(_=>{milk.spoiled=true},50500) } | setTimeout(_=>{milk.spoiled=true},50500) } | ||
</syntaxhighlight> | |||
<syntaxhighlight lang="js"> | |||
"use strict"; | |||
/* | |||
This is how you can make Javascript look more like Java: | |||
1. use CamelCase for naming variables instead of snake_case | |||
2. Use curly brackets to define blocks of code, even if they contain only one statement | |||
3. Use semicolons to terminate statements | |||
4. use doubles quotes instead of single quotes for strings | |||
5. use strict mode | |||
6. make the code into one big function called main() | |||
*/ | |||
function main(){ | |||
window.w.chat.send("Im using this more java looking javascript syntax to send this message"); | |||
}; | |||
main() | |||
</syntaxhighlight> | </syntaxhighlight> | ||