Skip to content

Commit ee2c0aa

Browse files
committed
es10 and output ques updated
1 parent 6b2f05b commit ee2c0aa

File tree

4 files changed

+46
-24
lines changed

4 files changed

+46
-24
lines changed

DOM-Manipulation-And-Events/Access-From-DOM/index.html

+10-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ <h3>Article 003</h3>
4040
asperiores odio est? Doloribus atque laborum pariatur fugit alias sunt possimus neque beatae,
4141
unde dolorum nisi non minima!</p>
4242
</article>
43+
44+
<article id="art-004" class="m-2 p-2 border border-secondary">
45+
<h3>Article 004</h3>
46+
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Neque pariatur molestias minus. Quia
47+
ullam voluptas laboriosam reprehenderit quisquam dolores dignissimos magni fuga dolor, animi
48+
voluptatem temporibus maiores totam facere eum odit sint, consequatur eveniet inventore cum
49+
officiis. At, sint voluptates exercitationem, quidem obcaecati id molestias cum dignissimos
50+
velit possimus nisi.</p>
51+
</article>
4352
</main>
4453
<aside id="sidebar" class="col-sm-4 bg-info text-white">
4554
<h4>Sidebar</h4>
@@ -60,4 +69,4 @@ <h4>Sidebar</h4>
6069
crossorigin="anonymous"></script>
6170
</body>
6271

63-
</html>
72+
</html>
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
// Get access to the DOM
2-
const main = document.querySelector('main');
2+
const main = document.querySelector("main");
33

4-
const articles = document.getElementsByTagName('article');
5-
const paragraphs = document.getElementsByTagName('p');
4+
const articles = document.getElementsByTagName("article");
5+
const paragraphs = document.getElementsByTagName("p");
66

77
const firstArticle = articles[0];
88
const secondParagraphs = paragraphs[1];
99

10-
const whiteTextElements = document.getElementsByClassName('text-white');
10+
const whiteTextElements = document.getElementsByClassName("text-white");
1111

12-
const sidebar = document.getElementById('sidebar');
12+
const sidebar = document.getElementById("sidebar");
1313

1414
// Modify the DOM
15-
const mainHeading = document.getElementById('main-heading');
16-
mainHeading.textContent = 'Modify the DOM';
15+
const mainHeading = document.getElementById("main-heading");
16+
mainHeading.textContent = "Modify the DOM";
1717

1818
// Getting access to the parent tag
19-
const header = document.getElementById('page-header');
20-
header.innerHTML = '<h2>Modify the DOM</h2>';
19+
const header = document.getElementById("page-header");
20+
header.innerHTML = "<h2>Modify the DOM</h2>";
2121

2222
// A touch of class with classList
23-
header.classList.add('text-center');
23+
header.classList.add("text-center");
2424

25-
sidebar.classList.remove('bg-info');
26-
sidebar.classList.add('bg-success');
25+
sidebar.classList.remove("bg-info");
26+
sidebar.classList.add("bg-success");
2727

2828
// Working with style
29-
header.style.padding = '1em';
30-
header.classList.remove('bg-dark');
31-
header.style.backgroundColor = '#B54135';
29+
header.style.padding = "1em";
30+
header.classList.remove("bg-dark");
31+
header.style.backgroundColor = "#26e5d6";
3232

3333
// The joy of creation (adding new article)
34-
let newArticle = document.createElement('article');
35-
let newHeading = document.createElement('h3');
36-
let newParagraph = document.createElement('p');
34+
let newArticle = document.createElement("article");
35+
let newHeading = document.createElement("h3");
36+
let newParagraph = document.createElement("p");
3737

38-
newHeading.textContent = 'Article 004';
39-
newParagraph.textContent = 'Lorem ipsum dolor, sit amet consectetur adipisicing elit. Neque consequatur impedit, et nulla fuga iste tempora doloribus dolores, aliquid quod nihil dicta! Modi, quaerat officiis! Quia repudiandae accusamus ad impedit corrupti pariatur, quod nam, velit eum, quas voluptatem! Repellat est quidem beatae eum sint?';
38+
newHeading.textContent = "Article 005";
39+
newParagraph.textContent ="Lorem ipsum, dolor sit amet consectetur adipisicing elit. Cum aliquam officiis deserunt excepturi molestias culpa maxime hic? Iure autem quidem velit unde quo hic sed veritatis eaque. Neque, perspiciatis ullam, eum consequatur necessitatibus totam nam aliquid eaque officiis illo ducimus ab libero quas laborum quod. Nemo veritatis perferendis, necessitatibus fugiat repellendus nam aut expedita esse aspernatur, suscipit officiis magni praesentium.";
4040

4141
newArticle.appendChild(newHeading);
4242
newArticle.appendChild(newParagraph);
4343

44-
newArticle.classList.add('m-2', 'p-2', 'border', 'border-secondary');
44+
newArticle.classList.add("m-2", "p-2", "border", "border-secondary");
4545

46-
newArticle.setAttribute('id', 'art-004');
46+
newArticle.setAttribute("id", "art-005");
4747

48-
main.appendChild(newArticle);
48+
main.appendChild(newArticle);
Binary file not shown.

Interview-Questions/output.js

+13
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,16 @@ function asyncForEach(array, cb) {
2020
asyncForEach([1, 2, 3, 4], (i) => {
2121
console.log(i);
2222
})
23+
24+
25+
// 4) Output? And explain (hint: Octal)
26+
console.log(016)
27+
28+
console.log(017)
29+
30+
console.log(026)
31+
32+
console.log(027)
33+
34+
// 5) Output?
35+
console.log([...'Hello']);

0 commit comments

Comments
 (0)