AWS LAMBDA TutorialarrItems = [4,5,6,8,9,10,35,70,80,31]; function countevennumbers (items) { return new Promise(resolve => { setTimeout(() => { let a = 0; for (var i in items) is a promise object. It does not give the count, as the count is incremented inside a setTimeout and the function call does not wait for the execution inside setTimeout and returns the promise object arrItems = [4,5,6,8,9,10,35,70,80,31]; function countevennumbers (items) { return new Promise(resolve => { setTimeout(() => { let a = 0; for (var i in items)0 码力 | 393 页 | 13.45 MB | 1 年前3
共 1 条
- 1













