JSFiddle - React, Tailwind, and code Playground
HTML
<input type="hidden" name="price[1]" value="10">
<input type="hidden" name="price[6]" value="230">
<input type="hidden" name="price[7]" value="40">
<input type="hidden" name="price[10]" value="10">
JavaScript
var a="";
$("input[type=hidden]" ).each(function( index ) {
a+=($(this).val()) + ",";
});
alert(a);