函数:判断输入值是否为空

mac2024-03-27  28

clearSpaces函数来源:https://blog.csdn.net/Z_pigeon/article/details/102832041 /** * 判断表单输入值是否为空 * @param [String] value[传入需要操作的数据] * @return [Boolean] [返回是否为空的状态位: true-空] */ function isWriteNull(value){ if (value === undefined || value === null) { return true } return clearSpaces(value, true) === '' } // 使用 console.log(isWriteNull()) // true console.log(isWriteNull(123)) // false

 

最新回复(0)