构造一个n+1的斐波那契数列,取最后一位 function fibonacci(n) { var a = 0, b = 1, arr = [0, 1]; while (arr.length < n + 1) { [a, b] = [b, a + b]; arr.push(b); } return arr[arr.length - 1] }