小编ECM*_*ipt的帖子

什么是.idea文件夹?

当我试图在Jetbrains Webstorm中创建一个项目时,会创建一个名为的文件夹.idea.如果我删除它可以吗?它会影响我的项目吗?

ide webstorm

169
推荐指数
4
解决办法
12万
查看次数

未捕获的ReferenceError:函数未使用onclick定义

我正在尝试为网站制作用户脚本以添加自定义表达.但是,我遇到了很多错误.

这是功能:

function saveEmotes() {
    removeLineBreaks();
    EmoteNameLines = EmoteName.value.split("\n");
    EmoteURLLines = EmoteURL.value.split("\n");
    EmoteUsageLines = EmoteUsage.value.split("\n");

    if (EmoteNameLines.length == EmoteURLLines.length && EmoteURLLines.length == EmoteUsageLines.length) {
        for (i = 0; i < EmoteURLLines.length; i++) {
            if (checkIMG(EmoteURLLines[i])) {
                localStorage.setItem("nameEmotes", JSON.stringify(EmoteNameLines));
                localStorage.setItem("urlEmotes", JSON.stringify(EmoteURLLines));
                localStorage.setItem("usageEmotes", JSON.stringify(EmoteUsageLines));
                if (i == 0) {
                    console.log(resetSlot());
                }
                emoteTab[2].innerHTML += '<span style="cursor:pointer;" onclick="appendEmote(\'' + EmoteUsageLines[i] + '\')"><img src="' + EmoteURLLines[i] + '" /></span>';
            } else {
                alert("The maximum emote(" + EmoteNameLines[i] + ") size is (36x36)");
            } …
Run Code Online (Sandbox Code Playgroud)

javascript onclick userscripts

67
推荐指数
4
解决办法
31万
查看次数

错误:使用未解析的标识符"进程"

操作系统:Ubuntu 16.04

Swift版本:3.0预览版6

我正在关注这个入门页面

greeter.swift

func sayHello(name: String) {
  print("Hello, \(name)!")
}
Run Code Online (Sandbox Code Playgroud)

main.swift

if Process.arguments.count != 2 {
    print("Usage: hello NAME")
} else {
    let name = Process.arguments[1]
    SayHello(name: name)
}
Run Code Online (Sandbox Code Playgroud)

我收到错误

$ swift build
Compile Swift Module 'myapp' (2 sources)
/Sources/main.swift:1:4: error: use of unresolved identifier 'Process'
if Process.arguments.count != 2 {
   ^~~~~~~
/Sources/main.swift:4:16: error: use of unresolved identifier 'Process'
    let name = Process.arguments[1]
               ^~~~~~~
<unknown>:0: error: build had 1 command failures
error: exit(1): swift/bin/swift-build-tool -f …
Run Code Online (Sandbox Code Playgroud)

swift

12
推荐指数
1
解决办法
4019
查看次数

使方法只能访问子类,而不是实例化的对象

public class Flight{
  private int flying = 0;   
  public boolean fly() {
     flying = 1;
     return isFlying();
  }
  private isFlying(){
    return flying > 0;
  }
}

public class CargoFlight extends Flight{

  public boolean startFlight(int passengers)
    if (passengers <= 0){
      return false;
    }

    return fly(); // Want to be able to do this

  }
}

 public class Airport{
   public static void main(){
     CargoFlight f1 = new CargoFlight();
     f1.fly(); // Don't want to be able to do this
  }
}
Run Code Online (Sandbox Code Playgroud)

f1有属性 …

java inheritance

4
推荐指数
1
解决办法
1454
查看次数

如何围绕现有元素创建新的锚标记

<span class="classname">
<img src="" width="70" height="70">
</span>
Run Code Online (Sandbox Code Playgroud)

我正在尝试添加一个锚标记,并在标记周围添加 URL。我不知道该怎么做,我已经被难住了好几个小时了..

html javascript

2
推荐指数
1
解决办法
2855
查看次数

多个无限循环

给出这段代码时:

while(true){
 ...
}
Run Code Online (Sandbox Code Playgroud)

可以异步执行多少次?

我已经写了这个来测试以及它如何与Google的JavaScript V8引擎交互,并且一次只有一个while循环处于活动状态.

var cycles = 0;
var counter = new Date();
var OpsStore = [];
var threads = [];

for(var i = 0; i < 10; i++){
  setTimeout(newThread(i),0);
}
function renew(){
    if (secondPassed(counter, new Date())){
        counter = new Date();
        Ops();
    }
    cycles++;
}

function newThread(id){
    threads.push({id: id, active: true});
    return function(){
        while(true){
            console.log(id);
            threads[id].active = true;
            renew();
        }
    }
}

function Ops(){
    OpsStore.push(cycles);
    console.log(cycles, ' avg: ', getAvgOps());
    console.log(threads);
    cycles = 0;
    for(var …
Run Code Online (Sandbox Code Playgroud)

javascript v8 node.js

1
推荐指数
1
解决办法
762
查看次数

标签 统计

javascript ×3

html ×1

ide ×1

inheritance ×1

java ×1

node.js ×1

onclick ×1

swift ×1

userscripts ×1

v8 ×1

webstorm ×1