<!DOCTYPE html>
<html lang="en-US">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head>
<body>
<h1>jQuery toArray() Method</h1>
<div>1</div>
<div>2</div>
<div>3</div>
<p>Click on the button and check you console.</p>
<button>Click Me</button>
<script>
$(document).ready(function(){
$("button").click(function(){
var arr = $("div").toArray();
console.log($.type(arr));
console.log(arr);
console.log(arr[0]);
});
});
</script> </body>
</html>