The original code caused jshint to complain about "variable 'name' used out of scope", which of course isn't strictly an accurate statement, with variable hoisting and all. However, the original code was also doing the equivalent of `name = val`, it just hid it at the end of a rather long ternary statement.

At this point, though, `name` and `val` are equivalent. If changing the next line to also use `val` (as this one does with the `indexOf`) makes it clearer, I'm all for that.