Skip to content

Commit ebbae81

Browse files
authored
Create 2011-final-value-of-variable-after-performing-operations.js
1 parent 1b562d2 commit ebbae81

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @param {string[]} operations
3+
* @return {number}
4+
*/
5+
const finalValueAfterOperations = function(operations) {
6+
let res = 0
7+
for(let op of operations) {
8+
if(op.indexOf('++') !== -1) res++
9+
else res--
10+
}
11+
12+
return res
13+
};

0 commit comments

Comments
 (0)