Skip to content

Instantly share code, notes, and snippets.

@chrisns
Last active March 30, 2019 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chrisns/10f3efe959c88367d48f to your computer and use it in GitHub Desktop.
Save chrisns/10f3efe959c88367d48f to your computer and use it in GitHub Desktop.

JS technical test

Scope

Consider the following code:

var a = b = 5;
console.log(b);

What will be printed on the console?

Hoisting

Describe what the following will return and why

function bar() {
   console.log(a);
   console.log(foo());
   var a = 1;
   function foo() {
      return 2;
   }
}
bar();

Flow

Describe the predicted output of, and why

console.log("john");
setTimeout(function() {
    console.log("jack");
}, 0);
console.log("jake");

Extend basic prototypes

Write javascript to make the following:

console.log('helloworld'.repeatit(3));

output: helloworldhelloworldhelloworld

Classes

  • How do you declare a class in Javascript?
  • How do you extend a class in Javascript?
  • How do you mixin a class in Javascript?
  • How do you create a new instance of a class?

Quickfire

  • Describe the difference between == and ===
  • Assuming function myfunc() {} describe the difference between myfunc() myfunc.call() and myfunc.apply()
  • Describe the difference between null and undefined
  • What is an error-first callback?
  • How can you avoid callback hells?
  • How can you listen on port 80 with Node?
  • What's the event loop?
  • What's the difference between operational and programmer errors?

Discussion points

  • AWS/rackspace/similar cloud
  • NoSQL stores
  • Docker
  • Technology you're excited about
  • Mysql when would you use INNODB vs MYSIAM
  • Talk about what HTTP methods there are and what they are used for.
  • Talk about what RESTful means to you
  • Describe what HATEOAS means to you
  • What tools can be used to assure consistent style?
  • Why npm shrinkwrap is useful?

What don't you like about:

  • JS/angular/backbone/ember
  • Node.js
  • Mysql/postgre
  • NoSQL store
  • other technology

Git

Assume you have commits pushed to origin:ABCDEF

  • You discover another developer put a password in C, discuss how you could go about editing that commit
  • You find it would make more semantic sense to reorder the commits to AEBCF
  • You find it would make more semantic sense to combine commits A & B Assume have another branch with commits: WXYZ
  • You want to take commit Y and add it after E

Testing

  • Describe a test pyramid
  • How can you implement it when talking about HTTP APIs?
  • Describe mocking, stubbing
  • Describe the difference between BDD and TDD
  • Why would you use BDD/TDD, are they mutually exclusive?

Docker

  • Describe the difference between RUN, CMD, and ENTRYPOINT
  • Describe the difference between ADD and COPY
  • What is a multi-stage build and why would you use one?
  • Figure how to start up and return a salted hash with the docker image chrisns/docker-devtest

Kubernetes

Your metrics appear to show that when the pod schedudles it bounces queries for a bit, why might this be?
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: mydeployment
spec:
  replicas: 30
  selector:
    matchLabels:
      name: mydeployment
  template:
    metadata:
      labels:
        name: mydeployment
    spec:
      containers:      
      - image: chrisns/mywonderful-notreal-app
        name: mydeployment
        livenessProbe:
          httpGet:
            path: /health/liveness
            port: http
          initialDelaySeconds: 90
          periodSeconds: 3
          timeoutSeconds: 1

        readinessProbe:
          httpGet:
            path: /health/readiness
            port: http
          initialDelaySeconds: 60
          periodSeconds: 3
          timeoutSeconds: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment