#Javascript-vehicle-purchase.js
24 messages · Page 1 of 1 (latest)
export function chooseVehicle(option1, option2) {
if (option2[0] > option1[0]){
return option2 + "is clearly the better choice.";
} else if (option1[0] > option2[0]) {
return option1 + "is clearly the better choice.";
}
}
What's the test failure say for this code?
Error: expect(received).toBe(expected) // Object.is equality
Expected: "Bugatti Veyron is clearly the better choice."
Received: "Ford Pintois clearly the better choice."
Below is the code run
expect(chooseVehicle('Bugatti Veyron', 'Ford Pinto')).toBe(
'Bugatti Veyron' + rest,
);
expect(chooseVehicle('Chery EQ', 'Kia Niro Elektro')).toBe(
'Chery EQ' + rest,
);
- Do you understand what the test is doing?
- Do you understand what the test is expecting and why?
- Do you understand what your code returns and how it differs?
- Do you understand why your code is returning what it returns?
- the test is asking me to sort which option is first in dictionary order and asking me to return it with a sentence at the end
i don’t understand why my code is returning something different
What should your code return vs what does it return?
Can you be specific about what your code is doing wrong?
@golden bridge ?
All solved?
Sure
Congrats!