Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>$.type()</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> </head> <body> <button id="run">Types</button> <pre id="out"></pre> <script> $("#run").click(function(){ var list = [42, "hi", null, undefined, [1], {a:1}, new Date()]; var types = $.map(list, function(v){ return $.type(v); }); $("#out").text(types.join(", ")); }); </script> </body> </html>
Output