javascript 里面的document.writeln是什么意思?

var beyond = {
formedIn: '1983',
foundedIn: '香港',
artist: ['黄家驹','黄家强','黄贯中',''叶世荣]
};

beyond.showArtist = function () {
for (var i = 0; i < this.srtist.length; i++) {
document.writeln(this.artist[i]);
}
};

beyond.showArtist()

console.log(beyond);

这里的document.writeln 是什么意思?

document.write()和document.writeln()有什么区别
解决思路:
两者都是JavaScript向客户端输出的方法,对比可知写法上的差别是一个ln--line的简写,换言之,writeln 方法是以行输出的,相当于在 winte 输出后加上一个换行符。追问

意思就是说,document.writeln 可以输出在浏览器页面上,
是这个意思吗?

追答<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>注册页面</title>
<script type="text/javascript">
var beyond =
    {
        formedIn : '1983',
        foundedIn : '香港',
        artist : [
                '黄家驹', '黄家强', '黄贯中', '叶世荣'
        ]
    };
    
    beyond.showArtist = function ()
    {
    for ( var i = 0; i < this.artist.length; i++)
    {
    document.writeln (this.artist[i]);
    }
    };
    
    beyond.showArtist ();
    console.log (beyond);
</script>
</head>
<body>
</body>
</html>

温馨提示:答案为网友推荐,仅供参考
相似回答