style guide for javascript code example
Example 1: javascript Name convention
// camelCase
//The general rule is to start variable, function and method names
//with a lowercase letter, class and object names with a capitalized letter,
//and constants are typically all caps.
//Follow these conventions, and your scripts will
//be consistent with what others are doing, and much easier to understand.
Example 2: javascript style an element
// Getting the element first
var myElement = document.querySelector("#myElement");
// examples for updating styles
myElement.style.color = "blue";
myElement.style.backgroundColor = "red";
Example 3: style through javascript
element.style.backgroundColor = "red"; // set the background color of an element to red