FULL CODE + IMAGES + SLIDES @ http://blog.breakthru.solutions/learn...
PLAYLIST: • Learn Javascript with a SIMPLE Projec...
FOLLOW ME ON TWITTER: / thepowerslacker
Variables, Arrays, &
Objects
Variables
Store data for later use
Have names and values
Declared with the var, let or const keywords
let & const are not implemented yet but can be used with Babel
Can store text (strings), numbers, booleans, and even functions
Example: var animal = ‘zebra’;
Arrays
Variables that store multiple values.
Can store any type of valueJust like variables
Example: var animals = [‘zebra’, ‘monkey’, ‘lion’];
Brackets [ ]Declare variables by using brackets on the ends
Access values with positionanimals[1] // returns monkeyAnimals[2] // returns lion
Objects / Hashes
Key-value pairs
Declared with braces { }
Access with key
Example:
var animals = {
‘jeffery’: ‘zebra’,
‘gordo’: ‘monkey’,
‘harambe’: ‘lion’
};
animals.harambe OR animals[‘harambe’] // returns lion
Tip
When using dynamic values (values that aren’t preset by you), use the brackets to access an object..
Смотрите видео VARIABLES, ARRAYS, & OBJECTS | Simple Javascript Project Tutorial & Training онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Powerslacker 29 Ноябрь 2016, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 7,164 раз и оно понравилось 37 людям.