코드를 디버깅 할 때 보통 코드 블록에서 Alert를 사용하여 JS 코드의 실행을 확인합니다. 오늘도 Console.log 함수를 사용하여 기능, 변수, 객체 및 Console.log의 사용법을 인쇄하는 친구가 아래에 기록되어 있습니다. 특정 구문은 다음과 같습니다.
console.log ( "value :", fn);
Console.log ()는 변수, 함수, 배열, 객체 등을 출력 할 수 있습니다.
<html> <head> <title>이 keyword_function Call </title> <meta http-equiv = "content-type"content = "text/html; charset = gb2312"> </head> <입력 = "text"id = "test1"name = "firstName"/> <입력 유형 = "텍스트" "텍스트" 이름 = 'lastName'value = ''> </body> <script type = "text/javaScript"> var testobj = { 'id': 1, 'content': 'test', 'firstName': function () {var elefirst = document.getElementById ( 'treed1'); //document.getElementById('FirstName').Value = "Zhang"; //document.getElementById("test1").value = this.content; //document.getElementById("test1").setattribute("value","zhang "); //this.content = val; elefirst.setattribute ( "value", this.content); Console.log ( "객체의 값은 :", test1); // 객체의 값은 다음과 같습니다. <input type = "text"id = "test1"name = "firstName"value = "" />}, 'lastName': function () {document.getElementById ( 'lastName'). value = "Ying"; }}; console.log (testobj);/ ** 인쇄 개체 **/ testobj.firstname (); testobj.lastname (); </script> </html>