问答详情
源自:4-3 [JavaScript]属性操作

!function(){function fd(){}; return delete fd;}() 返回true

!function(){function fd(){}; return delete fd;}()  返回true 求指教

提问者:0620yy 2015-08-12 10:46

个回答

  • qq_慕慕947699
    2019-10-22 10:55:26

    delete 操作符会从某个对象上移除指定属性;

    如果你试图删除的属性不存在,那么delete将不会起任何作用,但仍会返回true

  • 慕九州5609282
    2015-10-31 12:07:02

    感叹号取反了 换种写法就是true了

    (function(){function fd(){}; return delete fd;})() 

  • 慕九州5609282
    2015-10-31 11:58:10

    !function(){function fd(){ console.log('1')}; delete fd; fd()}()