Skip to content

Instantly share code, notes, and snippets.

@codergautam
Created March 23, 2021 23:48
Show Gist options
  • Save codergautam/5353df25c51e21e2d675c389cc755cbc to your computer and use it in GitHub Desktop.
Save codergautam/5353df25c51e21e2d675c389cc755cbc to your computer and use it in GitHub Desktop.
//Y value is quadratic checker
//Checks if given y values are quadratic
//Y values
var numbers = []
var arr2 = []
var arr3 = []
numbers.forEach((number, i) => {
if(i > 0) {
arr2[arr2.length] = number - (numbers[i-1])
}
})
arr2.forEach((number, i) => {
if(i > 0) {
arr3[arr3.length] = number - (arr2[i-1])
}
})
//if all values are equal, it is quadratic
console.log(arr3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment