Challange 0: Tell the truth
Write a function that returns the number of truthy values in a given array. Return 0 if given an empty array.// Examples
countTruthy([true, false, false, true, false]) // ➞ 2
openapi: 3.0.0 | |
info: | |
title: Sample API | |
description: Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML. | |
version: 0.1.9 | |
servers: | |
- url: http://api.example.com/v1 | |
description: Optional server description, e.g. Main (production) server | |
- url: http://staging-api.example.com | |
description: Optional server description, e.g. Internal staging server for testing |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: 'manual-test-namespaced' | |
namespace: 'nile2' | |
labels: | |
app: 'manual-test-namespaced' | |
spec: | |
replicas: 2 | |
selector: |
version: '3.5' | |
services: | |
es5: | |
container_name: es5 | |
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.10 | |
environment: | |
xpack.security.enabled: "false" | |
ES_JAVA_OPTS: '-Xms512m -Xmx512m' | |
ports: | |
- 9200:9200 |
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
[{ | |
"id": 1, | |
"first": "Conney", | |
"last": "Woodall", | |
"gender": "Male", | |
"level": 4301 | |
}, { | |
"id": 2, | |
"first": "Ingeborg", | |
"last": "Cuthill", |
[{ | |
"id": 1, | |
"first_name": "Taber", | |
"last_name": "Atlay", | |
"gender": "Male", | |
"value": 8326 | |
}, { | |
"id": 2, | |
"first_name": "Grace", | |
"last_name": "Petow", |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/jasmine.min.css"> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/jasmine.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/jasmine-html.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/boot.min.js"></script> |
// Under WTFPL license ;) | |
function ancestors(obj) { | |
var hierarchy = []; | |
if (['boolean', 'number', 'string', 'undefined'].indexOf(typeof obj) !== -1 || obj === null) { // primitives types | |
obj = Object(obj); | |
} else if (typeof obj === 'function') { | |
hierarchy.push( | |
obj.name || | |
(obj.toString().match(/function (\w*)/) || | |
obj.toString().match(/\[object (\w*)\]/))[1] || |