File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
solution/0500-0599/0592.Fraction Addition and Subtraction Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -171,14 +171,17 @@ func gcd(a, b int) int {
171
171
return gcd (b, a%b)
172
172
}
173
173
```
174
+
174
175
#### JavaScript
176
+
175
177
``` js
176
178
/**
177
179
* @param {string} expression
178
180
* @return {string}
179
181
*/
180
- var fractionAddition = function (expression ) {
181
- let x = 0 , y = 1 ;
182
+ var fractionAddition = function (expression ) {
183
+ let x = 0 ,
184
+ y = 1 ;
182
185
183
186
if (! expression .startsWith (' -' ) && ! expression .startsWith (' +' )) {
184
187
expression = ' +' + expression;
@@ -215,8 +218,8 @@ var fractionAddition = function(expression) {
215
218
216
219
return ` ${ x} /${ y} ` ;
217
220
};
218
-
219
221
```
222
+
220
223
<!-- tabs:end -->
221
224
222
225
<!-- solution:end -->
Original file line number Diff line number Diff line change 2
2
* @param {string } expression
3
3
* @return {string }
4
4
*/
5
- var fractionAddition = function ( expression ) {
6
- let x = 0 , y = 1 ;
5
+ var fractionAddition = function ( expression ) {
6
+ let x = 0 ,
7
+ y = 1 ;
7
8
8
9
if ( ! expression . startsWith ( '-' ) && ! expression . startsWith ( '+' ) ) {
9
10
expression = '+' + expression ;
You can’t perform that action at this time.
0 commit comments