Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.
/**
* @param {number[]} nums
* @return {number}
*/
var missingNumber = function(nums) {
let sum = nums.length*(nums.length+1)/2;
for(let i = 0; i<nums.length; i++){
sum -= nums[i];
}
return sum;
};