Hi, bro. Are you ready for short javascript task?
Jump to turn (6)
- 1Hi, bro. Are you ready for short javascript task?
- 2Could you write function convertNumber in javascript that accept one parameter:
- 3No, it's not fully correct. When i use convertNumber(70) output is 0070, but sho
- 4No, it still be incorrect. Output for convertNumber(70) still be '0070', should
- 5Okay, forget everything we did before. Let's try again Write function in Javascr
- 6I corrected it a little bit and now it works fine. Take a look and know it furth
- User
Hi, bro. Are you ready for short javascript task?
- Assistant
Hi! I'm an AI language model, so I don't have personal opinions or emotions, but I'm here to help with your JavaScript task. What do you need assistance with?
- User
Could you write function convertNumber in javascript that accept one parameter: number. It should convert number like that:
console.log(convertNumber(5)); // Output: 0005 console.log(convertNumber(5.5)); // Output: 0055 console.log(convertNumber(50)); // Output: 0500 console.log(convertNumber(55)); // Output: 0550 console.log(convertNumber(55.1)); // Output: 0551 console.log(convertNumber(551)); // Output: 5510 console.log(convertNumber(555.1)); // Output: 5551