Easy to understand JavaScript solution
\tvar minimumDifference = function(nums, k) {\n\t\tif (k === 1) return 0;\n\n\t\tlet minimum = Infinity;\n\t\tnums.sort((a, b) => b - a);\n\n\t\tfor (let index 
\tvar minimumDifference = function(nums, k) {\n\t\tif (k === 1) return 0;\n\n\t\tlet minimum = Infinity;\n\t\tnums.sort((a, b) => b - a);\n\n\t\tfor (let index = 0; index <= nums.length - k; index++) {\n\t\t\tconst max = nums[index];\n\t\t\tconst min = nums[index + k - 1];\n\n\t\t\tminimum = Math.min(minimum, max - min);\n\t\t}\n\n\t\treturn minimum;\n\t};
['JavaScript']