Home >Web Front-end >JS Tutorial >JavaScript fun question: Did you get a bonus?
It’s time to distribute project bonuses!
The boss asked you to write a program for him to use. Then after you read the design document, your eyes widened in surprise.
It turns out that this program is to write a function, which receives two parameters, salarysalary, and whether there is a bonusbonus.
Salary is an integer, bonus is a Boolean value.
If bonus is true, then the salary is multiplied by 10!
Otherwise, the salary remains intact.
Returns a salary string starting with the soft girl currency symbol "¥".
Well, after a busy day, it’s not a bad idea to use this topic for leisure and entertainment.
Then get it done quickly!
function bonusTime(salary, bonus) { bonus = bonus ? 10 : 1; return "¥" + bonus * salary; }
The above is a fun JavaScript question: Did you get a bonus? Content, for more related content, please pay attention to the PHP Chinese website (www.php.cn)!