big exercises for day 3, lots of functions :)

pull/862/head
Dzykas 2 years ago
parent f44e5814a7
commit 99efa7fe67

@ -20,7 +20,7 @@
background-color: black; background-color: black;
padding: 5px; padding: 5px;
margin: 5px; margin: 5px;
border-radius: 7px; border-radius: 6px;
} }
</style> </style>
<button onclick="triangleA()">Area of a triangle</button><br> <button onclick="triangleA()">Area of a triangle</button><br>

@ -94,5 +94,5 @@ const month = now.getMonth() + 1;
const date = now.getDate(); const date = now.getDate();
const hours = now.getHours(); const hours = now.getHours();
const minutes = now.getMinutes(); const minutes = now.getMinutes();
alert(`${currentYear}-${month}-${day} ${hours}:${minutes}`) alert(`${currentYear}-${month}-${day} ${hours}:${minutes}`);
} }

@ -1,49 +1,49 @@
let firstName = "Eligijus" let firstName = "Eligijus";
let lastName = "Dzikavicius" let lastName = "Dzikavicius";
let country = "Lithuania" let country = "Lithuania";
let city = "Kupiskis" let city = "Kupiskis";
let age = "17" let age = "17";
let isMarried = false let isMarried = false;
let year = "2023" let year = "2023";
console.log(parseInt("10")) console.log(parseInt("10"));
console.log(parseInt("9.8")) console.log(parseInt("9.8"));
let truthy1 = 12 // truthy let truthy1 = 12; // truthy
let truthy2 = "string" // truthy let truthy2 = "string"; // truthy
let truthy3 = true // truthy let truthy3 = true; // truthy
let falsy1 = 0 // falsy let falsy1 = 0; // falsy
let falsy2 = "" // falsy let falsy2 = ""; // falsy
let falsy3 = null // falsy let falsy3 = null; // falsy
console.log(4 > 3) // true console.log(4 > 3); // true
console.log(4 >= 3) // true console.log(4 >= 3); // true
console.log(4 < 3) // false console.log(4 < 3); // false
console.log(4 <= 3) // false console.log(4 <= 3); // false
console.log(4 == 4) // true console.log(4 == 4); // true
console.log(4 === 4) // true console.log(4 === 4); // true
console.log(4 != 4) // false console.log(4 != 4); // false
console.log(4 !== 4) // false console.log(4 !== 4); // false
console.log(4 != '4') // false console.log(4 != '4'); // false
console.log(4 == '4') // true console.log(4 == '4'); // true
console.log(4 === '4') // false console.log(4 === '4'); // false
console.log("python".length != "jargon".length) // false console.log("python".length != "jargon".length); // false
// All correct ! // All correct !
const now = new Date() const now = new Date();
const currentYear = now.getFullYear() const currentYear = now.getFullYear();
const month = now.getMonth() + 1 const month = now.getMonth() + 1;
const date = now.getDate() const date = now.getDate();
const day = now.getDay() + 1 const day = now.getDay() + 1;
const hours = now.getHours() const hours = now.getHours();
const minutes = now.getMinutes() const minutes = now.getMinutes();
const seconds = now.getSeconds() const seconds = now.getSeconds();
const allTime = now.getTime() const allTime = now.getTime();
console.log(`The current year is ${currentYear}`) console.log(`The current year is ${currentYear}`);
console.log(`The current month is ${month}`) console.log(`The current month is ${month}`);
console.log(`The current date is ${date}`) console.log(`The current date is ${date}`);
console.log(`The current day of the week is ${day}`) console.log(`The current day of the week is ${day}`);
console.log(`The current time is ${hours}:${minutes}:${seconds}`) console.log(`The current time is ${hours}:${minutes}:${seconds}`);
console.log(`The amount of seconds passed since Jan 1, 1970 is ${allTime}`) console.log(`The amount of seconds passed since Jan 1, 1970 is ${allTime}`);

Loading…
Cancel
Save