var ARR=[1,2,3,4];
var runningSum = function(nums) {
var arr=[];
for(var i=0;i<nums.length;i++){
if(i=0){
arr.push(nums[i]);
}else{
arr.push(nums[i]+nums[i-1]);
}
}
console.log(arr);
};
runningSum (ARR);
=下面报错======
PS C:\Users\PC-17\Desktop\trash\12.16_1\pagination> node app.js
<--- Last few GCs --->
[15272:000002322F3D55B0] 4199 ms: Scavenge 670.0 (704.3) -> 670.0 (704.3) MB, 0.3 / 0.0 ms (average mu = 0.996, current mu = 0.996) allocation failure
[15272:000002322F3D55B0] 6019 ms: Scavenge 1052.5 (1086.8) -> 1052.5 (1086.8) MB, 0.4 / 0.0 ms (average mu = 0.996, current mu = 0.996) allocation failure
[15272:000002322F3D55B0] 8988 ms: Scavenge 1626.3 (1660.6) -> 1626.3 (1660.6) MB, 0.4 / 0.0 ms (average mu = 0.996, current mu = 0.996) allocation failure
<--- JS stacktrace --->
FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory
1: 00007FF7B63003EF napi_wrap+110031
2: 00007FF7B62A6106 v8::internal::OrderedHashTablev8::internal::OrderedHashMap,2::NumberOfElementsOffset+33350
3: 00007FF7B62A6ED6 v8::internal::OrderedHashTablev8::internal::OrderedHashMap,2::NumberOfElementsOffset+36886
4: 00007FF7B6B59F7E v8::Isolate::ReportExternalAllocationLimitReached+94
5: 00007FF7B6B3ED1D v8::SharedArrayBuffer::Externalize+781
6: 00007FF7B69FD02C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1516
7: 00007FF7B64F6069 v8::internal::Isolate::FatalProcessOutOfHeapMemory+25
8: 00007FF7B6A26683 v8::internal::FactoryBasev8::internal::Factory::NewFixedDoubleArray+243
9: 00007FF7B68E6BC3 v8::debug::Script::GetIsolate+6003
10: 00007FF7B6771417 v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+170215
11: 00007FF7B6BE2B5D v8::internal::SetupIsolateDelegate::SetupHeap+463949
12: 0000024A901CB154
PS C:\Users\PC-17\Desktop\trash\12.16_1\pagination>
- 在Leetcode上面遇到一个题---求一维组的动态和导致内存溢出
- 在Leetcode上面遇到一个题---求一维组的动态和导致内存溢出
- >>" markdown 引用语法" href="https://www.manongdao.com/q-1395481.html" > 有没有办法让 markdown-it 支持 ">>>" markdown 引用语法
- markdown-it 自动生成链接的问题
- 井号与文字之间无空格时无法被 markdown-it 渲染
- 在Leetcode上面遇到一个题---求一维组的动态和导致内存溢出
- >>" markdown 引用语法" href="https://www.manongdao.com/article-2318498.html" > 有没有办法让 markdown-it 支持 ">>>" markdown 引用语法
- markdown-it 自动生成链接的问题
- 井号与文字之间无空格时无法被 markdown-it 渲染
- map本身有序,存入小写英文单词,希望从小到大再从大到小输出,有误
- nodeJS项目部署到服务器上去,但是端口被占用如何解决
- 使用nodejs写接口,session做登录验证遇到的问题
- 用express-session操作session在不同的接口中,访问结果不一样
因为你if判断写错了 兄弟 应该是