Post

Javascript 테스트

Javascript 실행 결과 보여주기

1
2
3
4
5
6
7
8
9
function fun1(out) {
  let obj = {
    id: "An object",
    f1: function() {
      out.innerHTML = this.id;
    }
  };
  obj.f1();
}

1
2
3
4
5
6
7
function fun2(out) {
  let arr = [ 'a', 'b', 'c'];
  arr.push('d'); // insert as last item

  let result = arr + '<br>' + arr.pop() + '<br>' + arr;
  out.innerHTML = result;
}

This post is licensed under CC BY 4.0 by the author.