控制台顺序输入
var a =
[[0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,0],
[0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0],
[0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0],
[0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0],
[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0],
[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0],
[0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0],
[0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0],
[0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0],
[0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0],
[0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0]]
var show = function(arr){
var str = ''
for(var i=0;i<arr.length;i++){
for(var j=0;j<arr[i].length;j++){
str += (arr[i][j]?'*':'-')
}
str+='\n'
}
console.log(str)
}
show(a)
红色心
var show = function(arr){
var str = ''
for(var i=0;i<arr.length;i++){
for(var j=0;j<arr[i].length;j++){
str += (arr[i][j]?'*':' ')
}
str+='\n'
}
console.log("%c%s",
"color: red;",
str);
}
show(a)
心全红
var a =
[[0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,0],
[0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0],
[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,0],
[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],
[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],
[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],
[0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0],
[0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0],
[0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0],
[0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0],
[0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0],
[0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0]]