You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just passing by leaving my two cents: I think the purpose of this exercise is to use Computed Property at its most. The actual official solution is indeed a correct solution, and if you strictly follow the rule of not using temporary variables, its actually a great solution since it doesn't use the var keyword at all.
Terminal presents the following as the official solution:
console.log({
[+process.argv[2] % 2 === 0 ? "even" : "odd"]: +process.argv[2],
[+process.argv[2] + +process.argv[3]]: +process.argv[2] + +process.argv[3],
});
When is should be something like (but probably prettier):
var evenOrOdd = +process.argv[2];
var evenOrOddKey = evenOrOdd % 2 === 0 ? "even" : "odd";
var sum = +process.argv[3] + evenOrOdd;
var obj = {
[evenOrOddKey]: evenOrOdd,
[sum]: sum
};
console.log(obj);
The text was updated successfully, but these errors were encountered: