Quality
Achieve exactly what is being requested
Display ‘Hello, World!’
console.log('Hello world!')
console.log('Hello, World!')
Don’t commit code that cannot be executed
function foo(): void {
console.log(`Hello`)
function foo(): void {
console.log(`Hello`)
}
Don’t allow code clones
function check_odd_or_even(input_number: number): string {
if (input_number % 2 == 0) {
return `${input_number} is Even`
} else {
return `${input_number} is Odd`
}
}
function check_odd_or_even(input_number: number): string {
let result = input_number % 2 == 0 ? 'Even' : 'Odd'
return `${input_number} is ${result}`
}