parent
243607df8f
commit
22830f2457
@ -1,16 +1,19 @@
|
|||||||
let a = "string";
|
let a = "string"
|
||||||
let b = true;
|
let b = true
|
||||||
let c = null;
|
let c = null
|
||||||
let d = undefined;
|
let d = undefined
|
||||||
|
|
||||||
let firstName = "Eligijus";
|
let firstName = "Eligijus"
|
||||||
let lastName = "Dzikavicius";
|
let lastName = "Dzikavicius"
|
||||||
let isMarried = false;
|
let isMarried = false
|
||||||
let age = 17;
|
let age = 17
|
||||||
let live = "Lithuania"
|
let live = "Lithuania"
|
||||||
|
|
||||||
let myAge = 17;
|
let myAge = 17
|
||||||
let yourAge = 30;
|
let yourAge = 30
|
||||||
|
|
||||||
console.log("I am " + myAge + " years old.");
|
console.log("I am " + myAge + " years old.")
|
||||||
console.log("You are " + yourAge + " years old.");
|
console.log("You are " + yourAge + " years old.")
|
||||||
|
|
||||||
|
let js = "JavaScript"
|
||||||
|
console.log(js.length)
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Day 2 Exercises</title>
|
||||||
|
</head>
|
||||||
|
<body style="background-color: black;">
|
||||||
|
<script src="level1.js"></script>
|
||||||
|
<script src="level2.js"></script>
|
||||||
|
<script src="level3.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
let challenge = "30 Days Of JavaScript"
|
||||||
|
console.log(challenge)
|
||||||
|
console.log(challenge.length)
|
||||||
|
console.log(challenge.toUpperCase())
|
||||||
|
console.log(challenge.toLowerCase())
|
||||||
|
console.log(challenge.substring(3))
|
||||||
|
console.log(challenge.substring(0,3))
|
||||||
|
console.log(challenge.includes("Script"))
|
||||||
|
console.log(challenge.split())
|
||||||
|
console.log(challenge.split(" "))
|
||||||
|
console.log(challenge.replace("JavaScript", "Python"))
|
||||||
|
console.log(challenge.charAt(15))
|
||||||
|
console.log(challenge.charCodeAt(11))
|
||||||
|
console.log(challenge.indexOf("a"))
|
||||||
|
console.log(challenge.lastIndexOf("a"))
|
||||||
|
console.log(challenge.startsWith("3"))
|
||||||
|
console.log(challenge.endsWith("t"))
|
||||||
|
console.log(challenge.match(/a/gi))
|
||||||
|
console.log(challenge.repeat(2))
|
||||||
|
console.log("30 Days of ".concat("JavaScript"))
|
||||||
|
|
||||||
|
|
||||||
|
let companies = "Facebook, Google, Microsoft, Apple, IBM, Oracle, Amazon"
|
||||||
|
console.log(companies.split(" ,"))
|
||||||
|
console.log(companies.split(", "))
|
||||||
|
|
||||||
|
let sentence = "You cannot end a sentence with because because because is a conjunction"
|
||||||
|
console.log(sentence.indexOf("because"))
|
||||||
|
console.log(sentence.lastIndexOf("because"))
|
||||||
|
console.log(sentence.search("because"))
|
||||||
|
|
||||||
|
console.log(" 30 Days Of JavaScript ".trim())
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
console.log("The quote 'There is no exercise better for the heart than reaching down and lifting people up.' by John Holmes teaches us to help one another.\n")
|
||||||
|
|
||||||
|
console.log("Love is not patronizing and charity isn't about pity, it is about love. Charity and love are the same -- with charity you give love, so don't just give money but reach out your hand instead.\n")
|
||||||
|
|
||||||
|
let num1 = parseInt("10")
|
||||||
|
let num2 = parseFloat("9.8")
|
||||||
|
if (num2 !== 10) {
|
||||||
|
num2 = 10
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
console.log(num1)
|
||||||
|
console.log(num2)
|
||||||
|
console.log("jargon python".includes("on"))
|
||||||
|
console.log("I hope this course is not full of jargon.".includes("jargon"))
|
||||||
|
console.log(Math.floor(Math.random() * 101))
|
||||||
|
console.log(Math.floor(Math.random() * 51) + 50)
|
||||||
|
console.log(Math.floor(Math.random() * 257))
|
||||||
|
|
||||||
|
let str = "JavaScript"
|
||||||
|
let randomNumber = Math.floor(Math.random() * str.length)
|
||||||
|
let randomCharacter = str[randomNumber]
|
||||||
|
console.log(randomCharacter)
|
||||||
|
|
||||||
|
console.log("1 1 1 1 1\n2 1 2 4 8\n3 1 3 9 27\n4 1 4 16 64\n5 1 5 25 125")
|
||||||
|
console.log("You cannot end a sentence with because because because is a conjunction".substring(31,54))
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
let love = "Love is the best thing in this world. Some found their love and some are still looking for their love"
|
||||||
|
|
||||||
|
console.log(love.match(/love/gi).length)
|
||||||
|
|
||||||
|
let because = "You cannot end a sentence with because because because is a conjunction"
|
||||||
|
|
||||||
|
console.log(because.match(/because/gi).length)
|
||||||
|
|
||||||
|
const sentence = '%I $am@% a %tea@cher%, &and& I lo%#ve %te@a@ching%;. The@re $is no@th@ing; &as& mo@re rewarding as educa@ting &and& @emp%o@weri@ng peo@ple. ;I found tea@ching m%o@re interesting tha@n any ot#her %jo@bs. %Do@es thi%s mo@tiv#ate yo@u to be a tea@cher!? %Th#is 30#Days&OfJavaScript &is al@so $the $resu@lt of &love& of tea&ching\n'
|
||||||
|
|
||||||
|
clean_sentence = sentence.replace(/\$|%|@|&|#|;/g, "")
|
||||||
|
|
||||||
|
console.log(clean_sentence)
|
||||||
|
|
||||||
|
let text = "He earns 5000 euro from salary per month, 10000 euro annual bonus, 15000 euro online courses per month."
|
||||||
|
|
||||||
|
let regex = /\d+/g;
|
||||||
|
let matches = text.match(regex)
|
||||||
|
|
||||||
|
let totalIncome = 0;
|
||||||
|
for (let i = 0; i < matches.length; i++) {
|
||||||
|
totalIncome += parseInt(matches[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
totalIncome *= 12;
|
||||||
|
|
||||||
|
console.log('Total Annual Income:', totalIncome, 'euro');
|
||||||
Loading…
Reference in new issue