JavaScript fun question: Did you get a bonus?

黄舟
Release: 2017-02-13 16:09:24
Original
1025 people have browsed it

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,bonusis a Boolean value.

Ifbonusistrue, then the salary is multiplied by10!

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; }
Copy after login


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 (m.sbmmt.com)!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!