<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>能夠給jq用也能夠給js用</title> <style> .dl{width: 100px; height: 100px; background: yellow;} </style> <script src='../jquery-3.1.1.min.js'></script> <script> $(function(){ var a='hellow'; var b=new Date; var c=' arrt '; var arr=['a','b','c','b','d',]; //$.type();判斷類型比typeof用處廣;能判斷new出來的對象屬性; console.log($.type(a)); console.log($.type(b)); //trim()能夠去除空格 console.log($.trim(c)); // inArray()相似於indexof; 獲取index; console.log($.inArray('c',arr)); // proxy(); 改變this指向; /* function show(fn1,fn2){ alert(fn1); alert(fn2); alert(this); } $(document).click($.proxy(show,window,3,4)); }) */ </script> </head> <body> <div class="dl"></div> </body> </html>