Giter Site home page Giter Site logo

4geeksacademy / master-javascript-programming-exercises Goto Github PK

View Code? Open in Web Editor NEW
55.0 3.0 266.0 2.33 MB

Complete selection of auto-graded and interactive Javascript exercises for anyone interested in learning Javascript!

JavaScript 100.00%
exercises javascript tutorial tutorials

master-javascript-programming-exercises's Introduction

Master JavaScript tutorial at 4Geeks Academy

By @alesanchezr and other contributors at 4Geeks Academy

Estas instrucciones están disponibles en 🇪🇸 español 🇪🇸

160 exercises about JavaScript

Complete selection of auto-graded and interactive JavaScript exercises, where you will put your problem-solving skills to the test and learn many of the most popular JavaScript methods.

One key thing to learn in the world of coding is that the same problem may have multiple valid solutions, the important thing is that you understand the logic and principles behind them.

One click installation (recommended):

You can open these exercises in just a few seconds by clicking: Open in Codespaces (recommended) or Open in Gitpod.

Once you have VSCode open, if exercises don't run automatically you can try typing on your terminal: $ learnpack start

Local Installation (only if needed)

Clone the repository in your local environment and follow the steps below:

  1. Install LearnPack, the package manager for learning tutorials and the node compiler plugin for learnpack, make sure you also have node.js 14:
$ npm i learnpack -g
$ learnpack plugins:install learnpack-node
  1. Start the tutorial/exercises by running the following command at the same level where your learn.json file is:
$ npm i [email protected] -g
$ learnpack start

How are the exercises organized?

Each exercise is a small React application containing the following files:

  1. app.js: Represents the entry JavaScript file that will be executed by the computer.
  2. README.md: Contains exercise instructions.
  3. test.js: Contains the testing script for the exercise (you don't have to open this file).

Note: The exercises have automatic grading, but it's very rigid and strict, my recommendation is to not take the tests too serious and use them only as a suggestion, or you may get frustrated.

Contributors

Thanks goes to these wonderful people (emoji key):

  1. Alejandro Sanchez (alesanchezr), contribution: (coder) 💻 (idea) 🤔, (build-tests) ⚠️ , (pull-request-review) 👀 (build-tutorial) ✅ (documentation) 📖

  2. Paolo (plucodev), contribution: (bug reports) 🐛, contribution: (coder), (translation) 🌎

  3. Ricardo Rodriguez (RickRodriguez8080) contribution: (build-tutorial) ✅, (documentation) 📖

This project follows the all-contributors specification. Contributions of any kind are welcome!

This and many other exercises are built by students as part of the 4Geeks Academy Coding Bootcamp by Alejandro Sánchez and many other contributors. Find out more about our Full Stack Developer Course, and Data Science Bootcamp.

master-javascript-programming-exercises's People

Contributors

akers2534 avatar alesanchezr avatar anggiealava avatar arielcalisaya avatar azim3triko avatar charlytoc avatar dotfortun avatar dsilva06 avatar elviraqdp avatar erneslobo avatar gorshet avatar jingunza avatar josemoracard avatar jtoledo88 avatar kant avatar kiddopro avatar lorenagubaira avatar lusferror avatar marcogonzalo avatar minimage avatar plucodev avatar sadiel0 avatar tommygonzaleza avatar umikami avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

master-javascript-programming-exercises's Issues

Excersice #032 - The statement is a bit confusing. Like the message of the test when it fails.

The statement says:

Write a function called addObjectProperty.
Given two objects and a key, addObjectProperty sets a new property on the 1st object at the given key. The value of that new property is the entire 2nd object.

var person1 = {
  name: 'Joe Blow',
  role: 'schlub'
};
var person2 = {
  name: 'Mr. Burns',
  role: 'supervisor'
};
addObjectProperty(person1, 'manager', person2);
console.log(person1.manager); // --> { name: 'Mr.Burns', role: 'supervisor' }

This is my code:

var person1 = {
  name: 'Joe Blow',
  role: 'schlub'
};
var person2 = {
  name: 'Mr. Burns',
  role: 'supervisor'
};
function addObjectProperty(obj1, key, obj2) {
  // tu codigo aqui
   obj1[key] = obj2;
   return obj1[key];
}
addObjectProperty(person1, 'manager', person2);

This code returns this value:

{
  name: "Mr. Burns",
  role: "supervisor"
}

Nevertheless, the test fails. Returning this text:

 ✓ (done) 0. Function addObjectProperty must exist
 x (fail) 1. The function must return the 2nd array values with the new key 
 x (fail) 2. The function must return the 2nd array values with the new key

This happens because the test evaluates the full value of the first object and not just the property as the statement and example code suggests.

Proposed solution:

Change the message of the statement and example code to:

Write a function called addObjectProperty.
Given two objects and a key, addObjectProperty sets a new property on the 1st object at the given key. The value of that new property is the entire 2nd object. The function must return the value of the first object including the the new property added.

var person1 = {
  name: 'Joe Blow',
  role: 'schlub'
};
var person2 = {
  name: 'Mr. Burns',
  role: 'supervisor'
};
addObjectProperty(person1, 'manager', person2);
console.log(person1); // --> { name: 'Joe Blow', role: 'schlub', manager: { name: 'Mr. Burns', role: 'supervisor' }}

and change the fail test message to something like this:
"The function must return the value of the 1st object including the new property added."

Addressing Precision Issues in Floating-Point Value Comparison

Description

When comparing floating-point values in unit tests using toBe, false negatives occur due to slight differences in precision. This issue leads to discrepancies like

    Expected: 24.9
    Received: 24.900000000000002

Solution: Implement toBeCloseTo for Floating-Point Comparison

To mitigate this problem, Jest documentation recommends using toBeCloseTo instead of toBe for comparing floating-point values. This method allows specifying a precision level for comparison. Refer to Jest documentation for details.

Screenshots

Exercise 129: Calculate Bill Total
image

Exercise 137: Compute Compount Interest
image

Issue with learnpack

While trying the first challenge when I enter the code for the answer then click on build and then test =>
Then I receive the following error message =>

Could not find the error report for 001-isOldEnoughToDrink

I tried different browsers, tried to run in the command line directly in vscode, checked the firewall was not blocking but everything seems ok.

Any advice ?

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.