>[danger]代码题:给一个有序数组和一个数字,要求返回该数字在有序数组中出现的起始位置和结束位置。 ~~~ const arr = [1, 1, 2, 2, 2, 3, 4]; const n = 2; getPosition(arr, n); // 输出: [2, 4] ~~~