Code Monkey home page Code Monkey logo

exercise-basic-js-3---practice-conditionals-with-true-or-false's Introduction

Welcome to My GitHub Profile! πŸ‘‹

New in tech and coding

Learning Goals πŸ“š

Currently, I'm exploring [Technology/Framework] and working on [Project/Goal].

exercise-basic-js-3---practice-conditionals-with-true-or-false's People

Contributors

devcodepush avatar

Watchers

 avatar

exercise-basic-js-3---practice-conditionals-with-true-or-false's Issues

Review of exercise Basic JS 3 - Practice conditionals with True or False

Hi Arman,
I have the chance to quickly review this exercise, and in general is all great. Just some remarks:

  • I would advice you that you take your time to name your variables and functions with a good and descriptive name. It’s a best practice to use camelCase (as you have done) and actually tell what the function is doing by giving the function name a verb as prefix. So instead of myFunction, what about something like checkResponses or something like that, a bit more informative :)
  • That function doesn't need a parameter, so you can remove it. You have put a "R" parameter but you never use it (see you invocation of the function myFunction();, you don't need anything. So remove it from the definition as well.
  • Review your if else statements. They work (well done!!), but you have some unnecessary code there. Some documentation here. In this case with just 2 possibilities (either is true or false), you don't need to use and else if (that is useful when having more than 2 scenarios). But you just have 2: this or that. So a super simple if and else pattern is all you need. With that pattern, the second else block will execute if the first if condition is false, so you don't need to write the condition again making it the opposite. With a simple else, is already defined.

I'll try to explain myself better. You have done something similar to this:

if(condition === true) {
// Run this code
} else if (condition !==true) {
// Run this instead
}

It works, and that's great. But let's try to be more efficient with our code, avoiding redundant things. The block below is exactly the same as this one:

if(condition === true) {
// Run this code
} else {
// Run this instead
}

I hope I'm explaining myself clear enough πŸ™πŸ», and sorry if not! Let me know if you understand all this, and try to improve your code in that sense. If this is not clear enough, let me know and we can discuss it more via Slack of jitsy until is clear :)
Well done, Arman!! πŸ’ͺ🏻

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.