Skip to content

Instantly share code, notes, and snippets.

function sum_even(a){
var sum = 0;
for (var i = 0; i < a.length; i++){
if(a[i] % 2 === 0){
sum += a[i];
}
}
return sum;
}
@elc49
elc49 / .eslintrc
Last active April 16, 2018 10:40
ESLint common rules for my development
{
"extends": ["prettier", "airbnb", "prettier/react"],
"plugins": ["prettier"],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"impliedStrict": true,
"jsx": true
@elc49
elc49 / some.go
Last active February 11, 2024 11:04
type ConditionIterator func(interface{}, int) bool
func Some(array []interface{}, iterator ConditionIterator) bool {
res := false
for index, data := range array {
res = res || iterator(data, index)
}
return res
}