Underscore.JS - isSet 方法

语法

_.isSet(object)

isSet 方法检查对象是否为 Set。请参阅以下示例 −

示例

var _ = require('underscore');

//示例 1:检查传递的参数是否为 Set
console.log(_.isSet(new Set()));

//示例 2:检查传递的参数是否为 Set
console.log(_.isSet('Test'));

将上述程序保存在tester.js中。运行以下命令执行该程序。

命令

\>node tester.js

输出

true
false

underscorejs_comparing_objects.html