I'm getting an error pushing newTask to allTasks, with the error being TypeError: allTasks.push is not a function
data
is the JSON data pulled from a file using fs
var allTasks = JSON.parse(data);
var newTask = {
id: Date.now(),
title: "BAM",
description: "BOOM",
image: "SLAM"
};
allTasks.push(newTask);
I've tried declaring allTasks
as an array before parsing JSON But that didn't work either.
via Ibrahim Abouhashish
No comments:
Post a Comment