我怎样才能把它写成三元形式:
if (localStorage.getItem("txt")) {
newNote(localStorage.getItem("txt"), localStorage.getItem("name"));
} else {
newNote();
}
这似乎不起作用:
newNote(localStorage.getItem("txt") ? localStorage.getItem("txt"), localStorage.getItem("name") ? newNote();