今天一个同事在吐槽 lua 不好使,然后发我一段代码
locla test = {} test['a'].b = 0 我:“??? a 对应的对象没有初始化直接访问 b 属性不是崩崩崩?”
回:“js 和 php 都能这么写啊...”
我:“php 我写的少,js 这不是典型的 property of undefined 么?正常语言但凡有一个不报错的都见鬼了”
于是人回了我一段
var test = {}; test['hasOwnProperty'].b = 0 我:“... hasOwnProperty 是特么的通用函数,有对象的好么?你写段 php ”
$test = array(); $test["a"]["b"] = 1024; print($test); 这见鬼的代码竟然不报错...
