Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个函数,如果某个值为负,我想返回 0。我知道我可以通过使用该max($value, 0)函数在 PHP 中实现这一点;是否有提供类似功能的 JavaScript 或 jQuery 函数?
max($value, 0)
您可以使用Math.max(value, 0).
Math.max(value, 0)