Skip to content

Commit d7b736e

Browse files
authored
Merge pull request #2 from dpvasani/dpvasani-patch-2
Add files via upload
2 parents 35d51e5 + 46469d4 commit d7b736e

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Ch 6 JavaScript In Browser Practice Set
2+
3+
// Q1)How can you log a message to the console using the console object?
4+
5+
// console.log("Hello, World!");
6+
7+
8+
// Q2)How can you display an error message in the console using the console object?
9+
10+
// console.error("An error occurred.");
11+
12+
13+
// Q3)How can you clear the console using the console object?
14+
15+
// console.clear();
16+
17+
18+
// Q4)How can you log a warning message to the console using the console object?
19+
20+
// console.warn("This is a warning.");
21+
22+
23+
// Q5)How can you display tabular data as a table in the console using the console object?
24+
25+
// const data = [
26+
// { name: "John", age: 25 },
27+
// { name: "Jane", age: 30 },
28+
// { name: "Bob", age: 35 }
29+
// ];
30+
// console.table(data);
31+
32+
// Q6)How can you write an error message to the console if a condition is false using the console object?
33+
34+
// const value = 10;
35+
// console.assert(value > 20, "Value should be greater than 20.");
36+
37+
38+
// Q7)How can you measure the time taken to execute a block of code using the console object?
39+
40+
// console.time("Timer");
41+
// // Code block to measure execution time
42+
// console.timeEnd("Timer");
43+
44+
45+
// Q8)How can you prompt the user to enter their name and log it to the console using the prompt function?
46+
47+
// const name = prompt("Enter your name:");
48+
// console.log("Hello, " + name + "!");
49+
50+
51+
// Q9)How can you display an alert box with a message to the user using the alert function?
52+
53+
// alert("This is an alert message.");
54+
55+
56+
// Q10)How can you display a confirm dialog box and log the user's choice to the console using the confirm function?
57+
58+
// const result = confirm("Are you sure you want to delete this item?");
59+
// if (result === true) {
60+
// console.log("Item deleted.");
61+
// } else {
62+
// console.log("Deletion cancelled.");
63+
// }

0 commit comments

Comments
 (0)