1 // basic usage 2 the console.log ( 'the most common usage \ n newline' ); . 3 console.error ( 'output an error message will be displayed in red' ); . 4 console.warn ( 'print warning information is displayed in yellow' ); . 5 console.info ( 'general Print' ); . 6 console.clear (); // Clear the above display console . 7 . 8 . 9 10 @ Login usage . 11 @ console.assert (BOOL, "info") If bool info is false or not print out print 12 is console.assert ( false , 'it is false determination information displayed' ); 13 // incoming objects displayed in tabular form or array 14 console.table ([[ 'China ','United States'],['it is good']]); 15 // print call chain Fn2 () call fn1 (), fn1 () call Fn () 16 function Fn () {console.trace ();} . 17 function Fn1 () {Fn ();} 18 is function Fn2 () {Fn1 ();} . 19 Fn2 (); 20 is // formatted output 21 is / * 22 is the console.log supported format flag has: 23 is % S placeholder 24 % D% i or an integer of 25 % F float 26 is % O% O Object Object 27 % CSS style C 28 * / 29 the console.log ( 'D%% +% D = D', l, 2,3 ); 30 // % O% O dom node is not the same when the print 31 is the console.log ( '% O' , the document.body); 32 the console.log ( '% O' , the document.body); 33 is // % c behind content, increase css style 34 @ attachment: console.log output hyperlink is automatically recognized and add color gray and underlined font style, and not covered with the C% 35 console.log ( '123% 456 C' , 'font-size: 36px; Color: Red;' ); 36 the console.log ( '123. 4% C% C 56 is http://www.google.com 789', 'font-size: 20px; Color: # ff8400; ',' font-size: 12px; Color: # 000 ' ); 37 [ // use css style load picture 38 // can not directly form the width and height, line-height image height, and then transferred padding 39 console.log ( '% c', ' background-image: url ( "http://iyeslogo.orbrand.com/150902Google/005.gif"); background-size: 120% 120%; background-repeat: no- REPEAT; background-position: Center Center; Line-height: 60px; padding: 30px 120px; ' ); 40 41 is 42 is 43 is // advanced uses 44 // timer, in milliseconds 45 console.time (); 46 is for ( var I 0 =; I <100000; I ++ ) { 47 var J = I * I; 48 } 49 console.timeEnd (); 50 // statistical code function is called or how many times 51 is var FN_ = function() {Console.count ( 'Hello World' );} 52 is for ( var I = 0; I <. 5; I ++ ) { 53 is FN_ (); 54 is } 55 // Check memory usage, is a property, without parentheses 56 is // console.memory; 57 is // used in the browser developer tool 58 // output packet can be nested 59 console.group ( 'packet. 1' ); 60 the console.log ( 'language' ); 61 is Console .log ( 'Mathematics' ); 62 is console.group (' other subjects' ); 63 is the console.log ( 'chemical' ); 64 the console.log ( 'Geography '); 65 console.log ( 'history' ); 66 console.groupEnd ( 'other subjects' ); 67 console.groupEnd ( 'group 1');
var o = "\u6e29\u99a8\u63d0\u793a\uff1a\u8bf7\u4e0d\u8981\u8c03\u76ae\u5730\u5728\u6b64\u7c98\u8d34\u6267\u884c\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u60a8\u7684\u8d26\u6237\u53d7\u5230\u653b\u51fb\uff0c\u7ed9\u60a8\u5e26\u6765\u635f\u5931 \uff01^_^" , t = "\u4e3a\u4e16\u754c\u5e26\u6765\u5fae\u5c0f\u800c\u7f8e\u597d\u7684\u6539\u53d8\u3002\u6b22\u8fce\u52a0\u5165\u652f\u4ed8\u5b9d\uff1a" , s = "https://job.alibaba.com/zhaopin/position_detail.htm?positionId=41641" , i = [t, " ", s].join(""); /msie/gi.test(navigator.userAgent) ? (console.log(o), console.log(i)) : console.log("%c 你好啊 %c Copyright \xa9 2004-%s\n%c" + o + "\n %c" + i + "\n ", 'font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;font-size:64px;color:#00bbee;-webkit-text-fill-color:#00bbee;-webkit-text-stroke: 1px #00bbee;', "font-size:12px;color:#999999;", (new Date).getFullYear(), "color:#333;font-size:16px;", "font-size:12px;")