Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion mod1_types_sentences.js
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
// Type your code here

console.log(`"Good mornig/afternon/night, it's xxx o'clock" \n`);

let hora = new Date().getHours();
let min = new Date().getMinutes();
let greeting;

if (hora >= 7 && hora < 13){
greeting = "Buenos dias";
}else if (hora >= 13 && hora < 22){
greeting = "Buenas tardes";
}else {
greeting = "Buenas noches";
}
console.log(`${greeting}, son las ${hora}, horas, y ${min} minutos\n`);

let pi = Math.PI.toFixed(6);
console.log(pi+"\n");

for ( i = 0; i < 23; i++) {
let dec = i
let hex = i.toString(16);
let oct = i.toString(8);
let bin = i.toString(2);
console.log(`Dec = ` + i + ` Hex = ` + hex + ` Oct = ` + oct +` Bin = ` + bin );
};
console.log("");
for ( i = 0; i < 23; i++) {
if(i % 2){
let dec = i;
let hex = i.toString(16);
let oct = i.toString(8);
let bin = i.toString(2);
console.log(`Dec = ` + i + ` Hex = ` + hex + ` Oct = ` + oct + ` Bin = ` + bin);
}
};

console.log("\nHi in Chinese is written as: " + "\u55e8\uff0c\u4f60\u597d\u5417");

console.log(' \n"The progam has finished" ');