This is just an exercise in a course, this app selects a random fruit from the fruits array and then the removeItem() function is supposed to remove that one from the array and returns the modified array, but I'm getting a weird output, and the function is not working.
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import {makeFruitArray} from "./foods";
import {randomFruit} from "./helpers";
import {removeItem} from "./helpers";
class App extends React.Component {
render() {
let baseSupply = makeFruitArray();
let fruitArray = makeFruitArray();
let fruitItem = randomFruit(fruitArray);
let remaining = removeItem(fruitArray, fruitItem);
console.log(remaining);
return (
<div>
<p>Current Supply {baseSupply}</p>
<p>I'd like one {fruitItem}</p>
<p>Here is your {fruitItem}</p>
<p>Current Supply {remaining}</p>
<p>May I have another one