小编Mer*_*337的帖子

addEventListener 中不带括号的函数是如何使用的?

我无法理解这个addItem()removeItem()被不带括号addEventListener('click', addItem)

var addButton = document.getElementById('add');
addButton.addEventListener('click', addItem);

var removeButton = document.getElementById('remove');
removeButton.addEventListener('click', removeItem);

function addItem(){
    console.log('Add Button clicked');
}

function removeItem(){
    console.log('Remove Button clicked');
}
Run Code Online (Sandbox Code Playgroud)

html javascript function

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

在Java中创建类类型的变量

代码中有Node nextNode.js 类。我无法理解它到底在做什么。是否创建一个名为 next 的对象。nodeA.next = nodeB使用时是否有存储价值。我正在尝试学习 LinkedList 但我无法了解到底发生了什么。

  class Node{
     int data ;
     Node next;
     Node(int data){
        this.data = data ;
     }
  }

  Node nodeA = new Node(6);
  Node nodeB = new Node(3);
  Node nodeC = new Node(2);


 nodeA.next = nodeB;
 nodeB.next = nodeC;
Run Code Online (Sandbox Code Playgroud)

java

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

标签 统计

function ×1

html ×1

java ×1

javascript ×1