Steps to get the solution: 1. Here we can use summation of first N natural number i.e n(n+1)/2 2. Loop over the items of array and add the items value in Sum variable 3. Now we have current sum in 'sum' variable and sum of all numbers can be found by using n(n+1)/2 4. We can find the missing number by subtracting 'sum' variable value from summation of n natural numbers. Code snippet:

/*---------code -----------*/ 
  function returnMissingNumber(arr) {
    let n=arr.length+1;
	let sum=0;
	for(let item of arr) {
	return x;
   let arr=[1,2,3,5];
   console.log(returnMissingNumber(arr));  //4