考虑这两个功能.
function func1() {
return
{
foo: 'bar'
}
}
function func2() {
return {
foo: 'bar'
}
}
Run Code Online (Sandbox Code Playgroud)
alert(typeof func2()) //return object
alert(typeof func1()) //return undefined
为什么在许多其他语言中括号的位置不重要?它是语言功能还是错误?
使用脚本标记:
<div id="first">
me is first
</div>
<script type="text/javascript">
var first = document.getElementById("first");
console.log(first);
</script>
Run Code Online (Sandbox Code Playgroud)
自我调用功能:
<div id="second">
me is second
</div>
<script type="text/javascript">
(function(){
var second = document.getElementById("second");
console.log(second);
})();
</script>
Run Code Online (Sandbox Code Playgroud)
自调用函数和<script>放在html元素后面的标记之间的用法有什么不同.我一直在调试找到差异.但他们似乎行为相同.或者仅仅是好/坏的做法?
我需要在字段中保存序列化数据.任何人都可以帮我弄清楚我怎么能在sitecore中做到这一点.
在sql server中,我可以定义xml足够的字段类型.但同样地,我在sitecore中找不到任何东西.虽然有两种称为html&的类型memo,但已被弃用.也想知道我可以使用这些中的任何一个.
我们正在使用sitecore 7.2 BTW.