As someone who is brand new to coding and still getting the hang of Javascript, I've been taking some basic courses and trying out challenges on my own. Despite searching for an answer to my question, I haven't found anything quite like it. If anyone knows the solution, please share!
My current quest involves creating a function that sorts a list of numbers (in an array) from least to greatest. Knowing that sort() doesn't always work correctly with numbers, I attempted to write my own solution after doing some research.
Below is what I've come up with so far, but it seems like there's a crucial step missing:
var sort = function(list){
function numberSort(a, b) {
return a - b;
};
numberSort(list);
Encountering a syntax error has left me puzzled. It appears that I'm struggling to pass the input (list) through the inner function in order for the sorting process to take place.
Can someone provide a more detailed explanation of what's causing this issue? I suspect I might not fully grasp the sorting function I discovered.
Appreciate any insights or guidance you can offer!