我不想推送 null 所以我要检查一个条件,但是我认为它说有一个语法错误
“无法测试‘void’类型的表达式的真实性”
我该如何正确地做到这一点?
localStorage.setItem('todoitems', JSON.stringify(this.todoitems))
? localStorage.setItem('todoitems', JSON.stringify(this.todoitems))
: [];
Run Code Online (Sandbox Code Playgroud) typescript ×1