I need to get the value of input[name="color_cost[0]"]
I have a jQuery script like this but the colorCost object is undefined     
var colorCost = $('input[name="color_cost[0]"]').val();
var colorCost = $('input[name="color_cost[0]"]').val();
console.log(colorCost);<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" name="color_cost[]" value="100">
<input type="text" name="color_cost[]" value="200">
<input type="text" name="color_cost[]" value="300">
<input type="text" name="color_cost[]" value="300">
0in the selector won't work.