SOURCE

var assert = (value, text) => {
  if(value === true) {
    console.log(text)
  } else{
    console.log('error')
  }
}

const ninjas = ['kuam', 'Hattori', 'Yagyu']
const samurai = new Array('oda', 'Tomoe')

assert(ninjas.length === 3 ,"there are three ninjas")
assert(samurai.length ===2, "and only two samurai")

assert(ninjas[0] ==='kuam','kuma is the first ninja')
assert(samurai[samurai.length - 1] === 'Tomoe', 'tomos is the last samurai')

assert(ninjas[4] === undefined, 'we get undefined')
ninjas[4] = 'ishi'
assert(ninjas.length === 5, 'arrays are 5')
console.log(ninjas)

ninjas.length = 2
assert(ninjas.length === 2,'there are only two ninjas now')
console.log(samurai)
assert(samurai[2])



console 命令行工具 X clear

                    
>
console