Coding

Notes for CodeSchool's Javascript Roadtrip 3

The following is my notes from Codeschools javascript road trip part 3 (https://www.codeschool.com/courses/javascript-road-trip-part-3). I have also included my answers to challenges. Please also see attached text file for better formatting.

Notes for CodeSchool's Javascript Roadtrip 2


1 LOOPS

while loop
runs code as long as boolean is true
while (expression is true) { do this code }

for loop
provides same looping functionality as while
for (initialize var; loop expression; increment var) { do this code }

2 CONDIIONALS

if and else statements
execute code based on conditions
if (condition) {
code
} else {
other code
}

else-if syntax
allows for checking more than one condition
final else is only used if other conditions not met
if (condition) {
code
} else if (condition2) {
code2
} else {
code3
}

Notes for CodeSchool's Javascript Roadtrip

Here are my notes for Code School's Javascript Road Trip: http://javascript-roadtrip.codeschool.com

1 VALUES

math operators:
+ - * / % (remainder from division)

javascript follows standard order of for math operations
PEMDAS

comparators - return booleans
> < == != >= <=

strings
how javascript stores and processes flat text
"strings needs quotes"

concationation: +
"cat " + "man" = "cat man"
works with numbers and expresions

special characters
\t tab
\" quotes
\\ backslash
\n newline

string comparisons

Homegrown Drupal 5 Webform SPAM Filtering

One of my clients started getting massive amounts of SPAM through his web form created contact form. Since this contact form is displayed as a block on ever page, I didn't want to put in an obtrusive captcha. I did try the hidden captcha module, but found that it is already automated against. I decided to hit it straight on and wrote a snippet of code to not submit, but error instead, when the body contains the http prefix.

Syndikovat obsah