parent
93ef3468f1
commit
9a2f755136
@ -0,0 +1,55 @@
|
|||||||
|
// 1.question
|
||||||
|
let challenge = '30 Days Of JavaScript';
|
||||||
|
// 2.question
|
||||||
|
console.log(challenge);
|
||||||
|
// 3.question
|
||||||
|
console.log(challenge.length);
|
||||||
|
// 4.question
|
||||||
|
challenge.toUpperCase();
|
||||||
|
// 5.question
|
||||||
|
challenge.toLowerCase();
|
||||||
|
// 6.question
|
||||||
|
let firstWord = challenge.substr(0, 2);
|
||||||
|
let firstWord1 = challenge.substring(0, 2);
|
||||||
|
console.log(firstWord);
|
||||||
|
console.log(firstWord1);
|
||||||
|
// 7.question
|
||||||
|
let restWord = challenge.slice(3);
|
||||||
|
console.log(restWord);
|
||||||
|
// 8.question
|
||||||
|
console.log(challenge.includes('Script'));
|
||||||
|
// 9.question 10.question
|
||||||
|
let arr = challenge.split(' ');
|
||||||
|
console.log(arr);
|
||||||
|
// 11.question
|
||||||
|
let itCompany = 'Facebook, Google, Microsoft, Apple, IBM, Oracle, Amazon'.split(',');
|
||||||
|
console.log(itCompany);
|
||||||
|
// 12.question
|
||||||
|
console.log(challenge.replace('JavaScript', 'Python'));
|
||||||
|
// 13.question
|
||||||
|
console.log(challenge.charAt(15));
|
||||||
|
// 14.question
|
||||||
|
console.log(challenge.charCodeAt('J'));
|
||||||
|
// 15.question
|
||||||
|
console.log(challenge.indexOf(challenge));
|
||||||
|
// 16.question
|
||||||
|
console.log(challenge.lastIndexOf(challenge));
|
||||||
|
// 17.question
|
||||||
|
console.log('You cannot end a sentence with because because because is a conjunction'.indexOf('because'));
|
||||||
|
// 18.question
|
||||||
|
console.log('You cannot end a sentence with because because because is a conjunction'.lastIndexOf('because'));
|
||||||
|
// 19.question
|
||||||
|
console.log('You cannot end a sentence with because because because is a conjunction'.search('because'));
|
||||||
|
// 20.question
|
||||||
|
console.log(challenge.trim(challenge));
|
||||||
|
// 21.question
|
||||||
|
console.log(challenge.startsWith('30'));
|
||||||
|
// 22.question
|
||||||
|
console.log(challenge.endsWith('JavaScript'));
|
||||||
|
// 23.question
|
||||||
|
console.log(challenge.matchAll('a'));
|
||||||
|
// 24.question
|
||||||
|
console.log('30 Days Of '.concat('JavaScript'));
|
||||||
|
// 25.question
|
||||||
|
let rep = challenge.repeat(2)
|
||||||
|
console.log(rep);
|
@ -0,0 +1,42 @@
|
|||||||
|
// 1.question
|
||||||
|
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.`
|
||||||
|
);
|
||||||
|
// 2.question
|
||||||
|
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."
|
||||||
|
);
|
||||||
|
// 3.question
|
||||||
|
(10 === '10') ? console.log(true) : +'10';
|
||||||
|
// 4.question
|
||||||
|
(parseFloat('9.8') === 10)?console.log(true): Math.ceil(+'9.8')
|
||||||
|
// 5.question
|
||||||
|
if ('python'.includes('on')&&'jargon'.includes('on')) {
|
||||||
|
console.log(true);
|
||||||
|
}
|
||||||
|
// 6.question
|
||||||
|
if ('I hope this course is not full of jargon'.includes('jargon')) {
|
||||||
|
console.log(true);
|
||||||
|
}
|
||||||
|
// 7.question
|
||||||
|
console.log(Math.floor(Math.random() * 101));
|
||||||
|
// 8.question
|
||||||
|
console.log(Math.floor(Math.random() * (101 - 50)) + 50);
|
||||||
|
// 9.question
|
||||||
|
console.log(Math.floor(Math.random() * 225));
|
||||||
|
// 10.question
|
||||||
|
|
||||||
|
// 11.question
|
||||||
|
console.log(
|
||||||
|
`1 1 1 1 1
|
||||||
|
2 1 2 4 8
|
||||||
|
3 1 3 9 27
|
||||||
|
4 1 4 16 64
|
||||||
|
5 1 5 25 125`
|
||||||
|
);
|
||||||
|
// 12.question
|
||||||
|
let sent = 'You cannot end a sentence with because because because is a conjunction';
|
||||||
|
let i = sent.indexOf('because');
|
||||||
|
let j = sent.lastIndexOf('because');
|
||||||
|
let len = 'because'.length;
|
||||||
|
console.log(sent.slice(i, j+len));
|
Loading…
Reference in new issue