Advertisement
Guest User

Untitled

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