如何使用逻辑OR运算符将一个属性的值分配给另一个属性?

时间:2014-07-08 08:12:07

标签: javascript ios nsdictionary

我需要 ios 代码来获取相应的Javascript代码

var readers = {
    publicAccess: false,
    ids: []
};

    readers.publicAccess = public_read || false; // a = b || c     this is the format .
    readers.ids = reads || [];

   //where public_read and reads are two property of another object.

有可能吗?

1 个答案:

答案 0 :(得分:0)

您可以选择ternary operator,例如for example

a = (b>c)?b:c