您的代码转到此处后,如何解决此问题

函数displayNewsPanel(){

console.log('here')

// Create a variable named 'newsItems' that is a handle to the element with the ID of 'newsPanel'

const newsItems = document.querySelector('#newsPanel')

// This is the array of news that you are to use. Note that it is an array of arrays.

const news =

    [

        ['May 22, 2018', 'Really Big News', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eum iusto provident sit vero, eius fugiat autem laboriosam, molestiae, quidem incidunt ducimus reiciendis fugit illo quisquam. Autem, veniam voluptas officia incidunt.', 'http://clark.edu'],

        ['May 30, 2018', 'OK News', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eum iusto provident sit vero, eius fugiat autem laboriosam, molestiae, quidem incidunt ducimus reiciendis fugit illo quisquam. Autem, veniam voluptas officia incidunt.', 'http://clark.edu'],

        ['June 14, 2018', 'GREAT NEWS!', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eum iusto provident sit vero, eius fugiat autem laboriosam, molestiae, quidem incidunt ducimus reiciendis fugit illo quisquam. Autem, veniam voluptas officia incidunt.', 'http://clark.edu'],

        ['July 2, 2018', 'Welcome Back', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eum iusto provident sit vero, eius fugiat autem laboriosam, molestiae, quidem incidunt ducimus reiciendis fugit illo quisquam. Autem, veniam voluptas officia incidunt.', 'http://clark.edu']

    ]

// Use this variable to build the output string that you will then use for the news

let output = ''

// Loop through the news array of arrays. No need for nested loops.

for (let i = 0; i < news.length; i++) {

    // Generate the HTML code that you will need to build the news string

 // Your code goes here

 // Add the output to the newsItem element

newsItems.innerHTML =输出

这是javascript。我陷入了生成生成新闻字符串所需的HTML代码的困境,我需要output = output + new [I] [0] .......

它应以如下格式显示: 命名日, Lorem ipsum颜色..., 已连结。 (超链接)

评论