GithubHelp home page GithubHelp logo

heartandhandstraining / coding_challenge-18 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zero-to-mastery/coding_challenge-18

0.0 1.0 0.0 3 KB

Solving tough JavaScript questions and improving your core understanding of the language

coding_challenge-18's Introduction

coding_challenge-18

This coding challenge is all about solving tough JavaScript questions and improving your core understanding of the language. JavaScript is at the core of all the libraries, frameworks and tools that we use. Mastering the language is one of the best investments you can make, so let's get through some tough interview questions!

Please Use the #coding-challenge channel on Discord to discuss and share your work. At the end of the challenge, I will compile everyone's submitted solutions on here.

What is the Challenge?

This challenge will be a fun one where you can do it at your own pace and can complete as many of the 11 questions as you would like. Below you will find JavaScript interview questions that you will have to try and solve and "answer" as what you think the output should be. At the bottom you will find the answer sheet. It's a fun one that will challenge your understanding of JavaScript so try and solve them all yourself before looking at the answers! Additionally, keep track of your answers and explanations in your github repo and submit them (see the The Rules Are section on how to do this).

What is the output in the console for the below questions:

0

var result = (function(a) {
  return a*a;
}(5.5));
console.log(result); //guess the output

1

const b = [1, 2, 3];
const f = (a, ...b) => a + b;

console.log(f(1));

2

let f = (...f) => f;
console.log(f(10));

f = (...f) => f.reduce(f => f);
console.log(f(10));

function ff() {
  return arguments;
}
console.log(ff(10));

f = f => f;
console.log(f(10));

3

var foo = 10;
bar = 3;
(function () {
  var foo = 2;
  bar = 1;
}())
bar = bar + foo;
console.log(bar);

4

var x = 5;

(function () {
    console.log(x);
    var x = 10;
    console.log(x); 
})();

5

(function(){
  var a = b = 3;
})();

console.log(typeof a);
console.log(typeof b);

6

function foo1() {
  return {
    bar: 'bar',
  };
}

function foo2() {
  return
  {
    'bar';
  }
}

console.log(foo1());
console.log(foo2());

7

console.log(0.1 + 0.2);
console.log(0.1 + 0.2 === 0.3);
console.log(9007199254740993 === 9007199254740992);

8

const a = {},
    b = {c:'b'},
    c = {b:'c'};

a[b] = 111;
a[c] = 333;

console.log(a[b]);

9

for (var i = 0; i < 5; i++) {
  setTimeout(function() { console.log(i); }, i * 1000 );
}

for (let i = 0; i < 5; i++) {
  setTimeout(function() { console.log(i); }, i * 1000 );

10

console.log(1 < 2 < 2);
console.log(3 > 2 > 1);

Answer Sheet:

Thank you to this excellent article https://ylv.io/top-ten-tricky-javascript-questions/ for inspiring this challenge! Have a look at the answers here only after you have tried and answered all of these 11 questions and you have submitted your answers as per the rules below...

The Rules Are:

  1. You have until June 30th at 11:59pm EST to submit your solution files/explanations (using Github. If you don't know how to do that, check out the lecture in the Git + Github section of the course). You will have to submit the link to the #coding-challenge Discord group with the following message: -challenge URL LINK TO YOUR ENTRY" . The bot will listen for the command in any channel it is in and will reply with "thanks for your submission" if it succeeded.

  2. Use whatever tools you have as developers (google, friends, Discord, programming buddy etc...) but I will not be offering any help with this challenge. Just like a developer, you must solve a problem and build something that will be challenging. Nobody will hold your hand during the job so we want to experience that by figuring it all out on your own with your team.

*** Please note: As with all my challenges there is zero benefit or monetary gain I recieve from it. This is just my way of thanking my students and making sure that you are able to continue gaining valuable knowledge outside of just my videos. It would mean a lot to me if you are able to rate my courses...5 star reviews make my day :)

coding_challenge-18's People

Contributors

aneagoie avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.