refactor: Renamed js to nodejs
- feat: Added util module
This commit is contained in:
		| @@ -17,6 +17,8 @@ Note: | ||||
| Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231,  231 − 1]. For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows. | ||||
| */ | ||||
| 
 | ||||
| const { assert }  = require('../../util/js');  | ||||
| 
 | ||||
| /** | ||||
|  * @param {number} x | ||||
|  * @return {number} | ||||
| @@ -40,18 +42,21 @@ const reverse = function(x) { | ||||
|  * Output: 321 | ||||
|  */ | ||||
| x = 123; | ||||
| console.log(reverse(x)); | ||||
| sol = 321; | ||||
| assert(reverse(x) === sol, 'Output: 321'); | ||||
| 
 | ||||
| /* Test Case 2 | ||||
|  * Input: -123 | ||||
|  * Output: -321 | ||||
|  */ | ||||
| x = -123; | ||||
| console.log(reverse(x)); | ||||
| sol = -321 | ||||
| assert(reverse(x) === sol, 'Output: -321'); | ||||
| 
 | ||||
| /* Test Case 3 | ||||
|  * Input: 120 | ||||
|  * Output: 21 | ||||
|  */ | ||||
| x = 120; | ||||
| console.log(reverse(x)); | ||||
| sol = 21; | ||||
| assert(reverse(x) == sol, 'Output: 21'); | ||||
		Reference in New Issue
	
	Block a user