add key value at the start object js code example
Example 1: add a value to the start of a list python
>>>var=7
>>>array = [1,2,3,4,5,6]
>>>array.insert(0,var)
>>>array
[7, 1, 2, 3, 4, 5, 6]
Example 2: how to get the value in a tag in react
import React, { Component } from 'react';
class App extends Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick = (event) => {
alert(event.target.innerText); // Click Me
alert(event.target.tagName); // BUTTON
}
render() {
return (
);
}
}
export default App;