var variable; if (condition) variable = "something"; else variable = "something else"; //is the same as: var variable = condition ? "something" : "something else";