개요[ | ]
- Day 0: Data Types
# | 문제 | 비고 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
0-1 Day e | |||||||||||
1 | JS10 Day 0: Hello, World! | ||||||||||
2 | JS10 Day 0: Data Types | ||||||||||
3 | JS10 Day 1: Arithmetic Operators | ||||||||||
4 | JS10 Day 1: Functions | ||||||||||
5 | JS10 Day 1: Let and Const |
JavaScript
Copy
'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
inputString += inputStdin;
});
process.stdin.on('end', _ => {
inputString = inputString.trim().split('\n').map(string => {
return string.trim();
});
main();
});
function readLine() {
return inputString[currentLine++];
}
JavaScript
Copy
function performOperation(secondInteger, secondDecimal, secondString) {
const firstInteger = 4;
const firstDecimal = 4.0;
const firstString = 'HackerRank ';
console.log( 1*firstInteger + 1*secondInteger );
console.log( 1*firstDecimal + 1*secondDecimal );
console.log( firstString + secondString );
}
JavaScript
Copy
function main() {
const secondInteger = readLine();
const secondDecimal = readLine();
const secondString = readLine();
performOperation(secondInteger, secondDecimal, secondString);
}
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.