Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 50ce9a1

Browse files
Merge pull request #3 from 1baga/master
Added a simple way to convert between strings and integer
2 parents bb94a7a + dd6f746 commit 50ce9a1

File tree

4 files changed

+34
-15
lines changed

4 files changed

+34
-15
lines changed

‎functions/es6Modules/index.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ console.log(math.sumAll(50, 10));
88
console.log(math.subtractAll(50, 10));
99
console.log(math.multiplyAll(50, 10));
1010
console.log(math.divideAll(50, 10));
11+
console.log(math.findModulus(50, 15));

‎functions/es6Modules/math.js‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
export const sumAll = (a, b) => {
2-
return a + b;
3-
}
4-
5-
export const subtractAll = (a, b) => {
6-
return a - b;
7-
}
8-
9-
export const multiplyAll = (a, b) => {
10-
return a * b;
11-
}
12-
13-
export const divideAll = (a, b) => {
14-
return a / b;
15-
}
1+
module.exports = {
2+
sumAll: (a, b) => {
3+
return a + b;
4+
},
5+
subtractAll: (a, b) => {
6+
return a - b;
7+
},
8+
multiplyAll: (a, b) => {
9+
return a * b;
10+
},
11+
divideAll: (a, b) => {
12+
return a / b;
13+
},
14+
findModulus: (a, b) => {
15+
return a % b;
16+
}
17+
};

‎functions/math/modulus.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function modulus(a, b) {
2+
return a % b;
3+
}
4+
5+
export { modulus };

‎operators/conversion.js‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Converting Integer to String
2+
let age = 34;
3+
let ageToString = '' + age;
4+
console.log(ageToString);
5+
console.log(typeof ageToString);
6+
7+
// Converting String to Integer
8+
let length = '785';
9+
let lengthToInt = +length;
10+
console.log(lengthToInt);
11+
console.log(typeof lengthToInt);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /