Недавно наткнулся в одном проекте:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
var count = 0; function increaseCount() { count = count + 1; } function decreaseCount() { count = count - 1; } function updateCount() { if (count >= 10) { document.getElementById('count').style.color = 'red'; } else { document.getElementById('count').style.color = 'black'; } } increaseCount(); increaseCount(); increaseCount(); decreaseCount(); updateCount(); |