console.log "january".substring(0,3);
console.log "melbourne is great".substring(0,12);
console.log "hamburgers".substring(4,10);
我想明白为什么这不起作用?为什么我得到一个错误,说:失踪;陈述前?
console.log "january".substring(0,3);
console.log "melbourne is great".substring(0,12);
console.log "hamburgers".substring(4,10);
我想明白为什么这不起作用?为什么我得到一个错误,说:失踪;陈述前?
console.log()
是一个函数。 JavaScript不是红宝石,括号是必需的:)
例子:
console.log("january".substring(0,3));
嗨加文,欢迎来到堆栈溢出。为了让您的答案更加完整,请考虑通过[编辑]向答案中添加示例。祝你好运! :) – jmort253
so console.log(“january”.substring(0,3)); – MartinElvar
Martin给出了一个很好的例子+1 –
如果你不喜欢周围函数的参数括号看看CoffeeScript的。我个人认为这是相当丑陋的,但很多人似乎都喜欢它... – ThiefMaster