Advertisement
Guest User

Untitled

a guest
Oct 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. function displayNums (n) {
  2. let html = '<ul>/n'
  3. let color
  4. for (let i = 0; i <= n; i++) {
  5. if (i % 2 === 0) {
  6. color = 'blue'
  7. html += ` <li><span style='color:
  8. ${color}'>${i}</span></li>\n`
  9. console.log(html)
  10. } else {
  11. color = 'green'
  12. html += ` <li><span style='color:
  13. ${color}'>${i}</span></li>\n`
  14. console.log(html)
  15. }
  16. }
  17. }
  18. displayNums(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement