Hey all,
So I was completely lost and decided to look at the solution to the Beat Mix Project (Project 2). I realize now it’s better to come to the forum and look for help but there was no Beat Mix posts and I had no specific questions to ask aside from “Where do I even begin??”.
Anyways, in the solution for presentHandler.js is the following code:
const presetHandler = (method, index, newPresetArray) => {
if (method === 'GET') {
let preset = getPreset(index);
if (preset) {
return [200, preset];
} else {
return [404];
}
} else if (method === 'PUT') {
const newPreset = createOrUpdatePreset(index, newPresetArray);
if (newPreset) {
return [200, newPreset];
} else {
return [404];
}
} else {
return [400];
}
};
I’m confused why the GET method requires a let function whereas the PUT method uses const? They seem to be almost identical? Any help would be much appreciated. Thanks!