JSFiddle - React, Tailwind, and code Playground

JavaScript

var arr = [1, 2, 3, 4, 5, 6, 7];

var result = arr.filter(function(val) {
	if(val < 3 || val > 6) return false;
  return true;
});

alert(result);