Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一堆变量的值是从数据库中获取的。它们是“真”或“假”的布尔值。将所有具有“true”值的变量更改为字符串值“yes”的最简单方法是什么,并且所有值为“false”的变量都将更改为“no”?
for (var i=0; i<myArray.length; i++) { myArray[i] = myArray[i]? "yes" : "no"; }