Содержание
- 2. Agenda Program flow control - conditions - loops - switch statement Collections - array - hash
- 3. Program Flow Control
- 4. Program flow Operators in a program processed in linear order: from top to bottom and from
- 5. Conditions: if-else Most of algorithms have situation when next step related of some conditions depended on
- 6. Conditions: if-else Example: function discount (type) { if (type === “silver”) { price *= 0.9; }
- 7. Conditions: ?: Sometimes if-else too bulky. If we need to initialize a variable modifying it by
- 8. Conditions: ?: function discount (type) { if (type === “silver”) { price *= 0.9; } if
- 9. Loops: for Loops are used when algorithm requires repeating of statements. First of them: for -
- 10. Loops: while and do-while Two others types of loops: while and do-while while (condition) { body
- 11. Loops: examples Example 1: for (var i = 0; i console.log(“Iteration # %d”, i + 1);
- 12. Which type of loop to use? It may be not so simple to decide which type
- 13. Loops: break and continue There are two keywords for loops control : break – aborts loop
- 14. Switch Switch statement allows to select one of many blocks of code to be executed. If
- 15. Switch Example: This switch looks for the word equivalent for a mark in the 5-point system
- 16. Collections
- 17. Collections Collection is a set of variables grouped under common name. Usually elements of collections are
- 18. Arrays
- 19. Array: creation There are two ways to create an array: var name = [ ]; //
- 20. Array: processing Usage of arrays: var array = [] // declaration of empty array var array
- 21. Array: processing In the sample below we output all elements of the array to the console:
- 22. Array: features Arrays in JavaScript differ from arrays in classical languages. Arrays in JS are instances
- 23. Array: length calculation Let's discuss length calculation. It’s a virtual property. Arrays don't review own elements.
- 24. Array: useful methods Some useful methods of array: array.push(value) – add element to the end of
- 25. Array: forEach Not so long ago array received very comfortable method forEach. This method circulates around
- 26. Hash Table
- 27. Hash Table: creation Sometimes we need an Array with string indexes (keys). There is a special
- 28. Hash Table: creation We can create hash and initialize it at the same time. For this
- 29. Hash Table: usage Usage of hash tables is very similar to arrays: hash[“good”] = 4; //
- 30. Array vs Hash Use Array for collections with digital indexes. Use Hash if you want use
- 32. Скачать презентацию


















![Array: processing Usage of arrays: var array = [] // declaration of](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/377515/slide-19.jpg)










С Днем Победы!!!
Изображение и обозначение резьбы
Внешняя политика Россиив начале XIX века
Среднесрочное планирование серии последовательных уроков в 7 классе по английскому языку
Понятие политического процесса, его сущность и основные характеристики
Примечания и оговорки в нормативно-правовых актах
Презентация на тему Ноев ковчег
ППКПиУ Вектор-1
Внедрение предмета Проектная деятельность учащихся в школьный компонент учебного плана
Понятие исковой давности
Художественная роспись ткани
Нижегородский край XV век
Понятие государства
Болото
Настройки
Информационное сотрудничество между застройщиками и СМИ.
Презентация на тему Кратные интегралы
Аборты в православии
Нововведения в PHP 5.3 и PHP 6.0 Нововведения в PHP 5.3 и PHP 6.0
Япония - как жертва сравнительного права
Как рождался всемирный праздник. Легенды и мифы Древней Греции
The 10th anniversary of the Russian Space Forces
Лёгкая атлетика. Основы знаний
МБУДО Детская школа искусств
Розы на день матери
Фаза проектирования научного исследования
Межнациональные конфликты
О ходе реализации программы модернизации здравоохранения Архангельской области