the following is the code I have written
var nums = [1, 5, 4, 2, 3];
var sortedNums = [1, 2, 3, 4, 5];
var sorter = function MakeSorter() {
'sortNums': function(nums) {
return this.nums.sort();
};
};
QUnit.test("Numeric list can be sorted", function(assert) {
var sorted = sorter.sortNums(nums);
assert.deepEqual(sorted, sortedNums, "Passed!");
});
My supposition are as follows:
sorter is a function object referencing MakeSorter() function
sortNums is a property of MakeSorter which turns out to be an object and hence has the function syntax
but it produces the error as expected ";" on the line where sortNums is declared.why?
this.sortNums = function(){..