Create a new repository on your GitHub. This will your repo for JS exercises.
Do each of the following exercises in a separate file, and upload them to your repo on GitHub.
Create a commit for each exercise (if you want you can add more commits for your convenience).
Submit the link to your repository when you're done.
Write a piece of code that computes the sum of digits of a 3-digit number. You can use the template below:
const num = 123
let sum = 0
// your code goes here
console.log(sum)
Test your code on several different 3-digit numbers (for example 666, 300, 725). Hint: you might need to use Math.floor...
Write a piece of code that finds the solutions for a quadratic equation. You can use the following template:
const a = 1; b = -6; c = 9; // stands for x**2 - 6*x + 9 = 0
let solutionA = solutionB = 0
// your code goes here
console.log(solutionA, solutionB)
You can find on Google the formula to find the solutions. Test your code on different a, b, c values (like 1, 5, 6 or 1, -1, -1)
Write a piece of code that calculates the absolute value of a given number,
WITHOUT using Math.abs (though you still can use other Math methods).
const num = -8
let absolute;
// your code goes here
console.log(absolute)
Test your code on positive numbers, negative numbers, and zero.
You can run your code using the devtools console, or you can install the Quokka extension for VS Code, or any other method that works for you.
js-exercises's Introduction
js-exercises's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.