This PDF 1.5 document has been generated by / Skia/PDF m64, and has been sent on pdf-archive.com on 07/11/2017 at 19:26, from IP address 131.251.x.x.
The current document download page has been viewed 203 times.
File size: 113 KB (2 pages).
Privacy: public file
Download original PDF file
Share on social networks
Link to this file download page
Remember! It’s still object oriented!
no classes. Always approach the problem in an object oriented fashion, always
remember to separate classes if necessary and don’t be afraid from using
and to create a hierarchy for your objects. This is especially useful when creating
web apps and will help you endlessly for both usability and maintainability, well
written objects and their children are the key to a smooth running and easily
Remember your code conventions.
- Use camelCase, like you would be if you were coding in its non script
- Constants that are declared will LOOK_LIKE_THIS
- The declaration of variables always starts with ‘var’
- Always uses an explicit scope.
- There are no wrappers for the primitive objects!
Use global variables lightly!
security reasons, remember that global variables can be manipulated and gotten by
the user, which we’d rather keep under wraps if possible, it is also very easy when
accidently using a different variable and not even know it, obviously creating a range
of problems when it comes to you debugging, you also have to think about the user,
allocation space and saving global variables can be fairly costly over time, so best to
be safe and keep the scope of your variables as local as possible if you can help it.
Always return your functions as early as possible, keep it readable and
running as fast as possible!
Remember that your code should always flow, and when writing a function it should
look how the code will flow, it is a script after all, but also remember that if you can
exit out of a large function, why not do so at the first possible opportunity? While
avoiding long lines of Else if statements.
To illustrate this look at the code below.
It waits till the end to throw the error and also enters into a new code block, however
if we rearrange this a little we can make it return faster.
Look how it now exits out at the first check, before anything is attempted the first
check is done and then code block can exit before trying to execute code that might
just slow it down.
C2(2010), Global variables are bad - http://wiki.c2.com/?GlobalVariablesAreBad
Link to this page
Use the permanent link to the download page to share your document on Facebook, Twitter, LinkedIn, or directly with a contact by e-Mail, Messenger, Whatsapp, Line..
Use the short link to share your document on Twitter or by text message (SMS)
Copy the following HTML code to share your document on a Website or Blog