javascript optional chaining if statement