代码之家  ›  专栏  ›  技术社区  ›  DMCS

VS2008正在将我的javascript自动格式化为.js文件,我希望它停止

  •  4
  • DMCS  · 技术社区  · 17 年前

    VS2008 Removes my Indentation in .js file

        function doSomething(withMe) 
        {
            for (idx in myArray) 
            {
                if (myArray[idx] != -1) 
                {
                    return "yep";
                }
            }
            return "nope";
        }
    

        function doSomething(withMe) {
            for (idx in myArray) {
                if (myArray[idx] != -1) {
                    return "yep";
                }
            }
            return "nope";      
        }
    

    2 回复  |  直到 8 年前
        1
  •  7
  •   cjibo    17 年前

    展开文本编辑器

    取消选中所有格式选项。

    alt text

        2
  •  4
  •   jonnii    17 年前

    return
    {
        'foo': 3
    };
    

    return;
    {
        'foo': 3
    };
    

    我建议你教育你的团队,养成按照VS建议格式化javascript的习惯。这会让你摆脱自我。


    myArray[idx] != -1
    

    myArray[idx] !== -1
    

    这将阻止它进行类型强制。事实上。..永远不要使用==或!=始终使用===和!==.