Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

var units = "years"; var davidAge = 65; var johnAge = 40; var ageDifference = davidAge - johnAge; alert("The age difference is " + ageDifference + " " + units);

The code is more readable with an appropriately named variable, 
rather than including an arithmetic expression 
inside of parentheses inside of a concatenation.
Source by canvas.instructure.com #
 
PREVIOUS NEXT
Tagged: #var #units #var #davidAge #var #johnAge #var #ageDifference #davidAge #age #difference #ageDifference
ADD COMMENT
Topic
Name
1+2 =