07-2.JSON表示方式-数组.html 577 B

1234567891011121314151617181920212223
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. </head>
  9. <body>
  10. <ul class="score">
  11. </ul>
  12. </body>
  13. <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
  14. <script>
  15. // 2、数组
  16. var score = [98,90,100,99,96,97]
  17. score.forEach(function(value,index){
  18. console.log(value)
  19. $('.score').append('<li>'+ value +'</li>')
  20. })
  21. </script>
  22. </html>