How can I export this method to another React Component?
// utils.js
Array.prototype.last_element = function() {
const last_index = this.length-1;
return this[last_index];
};
export default ... ?
// main.jsx
import ... ? from './utils.js';
const arr = [1 , 2 , 3];
console.log(arr.last_element());