Answers for "add data to an array"

0

jquery add element to array

var ids = [];

    $(document).ready(function($) {
    var $div = $("<div id='hexCodes'></div>").appendTo(document.body), code;
    $(".color_cell").each(function() {
        code = $(this).attr('id');
        ids.push(code);
        $div.append(code + "<br />");
    });



});
Posted by: Guest on November-23-2020
0

adding an item to an array

addItems = items => {
  this.setState({
    emp: [
      ...this.state.emp,
      ...items
    ]
  })
}
Posted by: Guest on June-02-2021
0

adding an item to an array

addItem = item => {
  this.setState({
    emp: [
      ...this.state.emp,
      item 
    ]
  })
}
Posted by: Guest on June-02-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language