相关疑难解决方法(0)

什么"!" 运算符在javascript中与非布尔变量一起使用时的意思?

在阅读javascript代码时,我一直看到! operator used for non boolean variables. Here is an example of code not used in.

/**
 * loads a resource from a url
 * @param {string} url the url of the resource to load
 * @param {string} relativeTo the url to load relative to
 * @param {function} callback thefunction to call once the file is loaded
 * @private
 */
 GLGE.Wavefront.prototype.loadFile=function(url,relativeTo,callback){
    if(this.relativeTo && !relativeTo) relativeTo=this.relativeTo; //<-- used on a string?
    else this.relativeTo=url;
    if(!callback) callback=this.loaded;    //<-- used on a function? …
Run Code Online (Sandbox Code Playgroud)

javascript operators

13
推荐指数
2
解决办法
6428
查看次数

标签 统计

javascript ×1

operators ×1