how to get nth fibonacci javascript

JavaScript
function nthFib(n) {
	if(n <= 2) return n -1;
  return nthFib(n - 2) + nthFib(n - 1);
}
Source

Also in JavaScript: