Skip to content

Commit 05a198c

Browse files
authored
Add files via upload
1 parent 8f461c2 commit 05a198c

File tree

1 file changed

+132
-112
lines changed

1 file changed

+132
-112
lines changed

Ch 6 JavaScript In Browser.js

Lines changed: 132 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@
6464

6565
// The console object in JavaScript provides a set of methods that allow developers to interact with the browser's console. These methods are useful for logging messages, debugging code, and monitoring the execution of JavaScript code. Here are some commonly used methods of the console object along with examples:
6666

67+
// console.log(conslole) -> List All Console Method
68+
69+
// External JS is Better To Use -> Sepration Of Concerns & Browser Caching -> Browser Save That FIle SO We Not Load Again It
70+
6771
// log(): Logs a message to the console.
6872

6973
// console.log('Hello, World!'); // Output: Hello, World!
@@ -129,115 +133,131 @@
129133
// console.time('Timer');
130134
// // Code block to measure execution time
131135
// console.timeEnd('Timer'); // Output: Timer: <time in milliseconds>
132-
133-
134-
135-
// List
136-
137-
// assert() -> Writes an error message to the console if a assertion is false
138-
// clear() -> Clears the console
139-
// count() -> Logs the number of times that this particular call to count() has been called
140-
// error() -> Outputs an error message to the console
141-
// group() -> Creates a new inline group in the console. This indents following console messages by an additional level, until console.groupEnd() is called
142-
// groupCollapsed() -> Creates a new inline group in the console. However, the new group is created collapsed. The user will need to use the disclosure button to expand it
143-
// groupEnd() -> Exits the current inline group in the console
144-
// info() -> Outputs an informational message to the console
145-
// log() -> Outputs a message to the console
146-
// table() -> Displays tabular data as a table
147-
// time() -> Starts a timer (can track how long an operation takes)
148-
// timeEnd() -> Stops a timer that was previously started by console.time()
149-
// trace() -> Outputs a stack trace to the console
150-
// warn() -> Outputs a warning message to the console
151-
152-
153-
// Interaction In JavaScript: Prompt, Alert, And Confirm
154-
155-
// 1. prompt -> Take Input From User
156-
157-
// Example:
158-
159-
// const name = prompt('Enter your name:');
160-
// console.log('Hello, ' + name + '!');
161-
162-
// inp = prompt("Hi", "No") -> No Is Optional Default Value
163-
164-
// This example prompts the user to enter their name and stores the entered value in the name variable. It then logs a greeting message to the console using the entered name.
165-
166-
167-
// 2. alert
168-
169-
// The alert method displays a dialog box with a message to the user. It is primarily used to show information or provide notifications to the user.
170-
171-
// Example:
172-
173-
// alert('This is an alert message.');
174-
// This example displays an alert box with the message "This is an alert message."
175-
176-
177-
// 3. confirm
178-
179-
// The confirm method displays a dialog box with a message and two buttons: OK and Cancel.It allows the user to confirm or cancel an action.It returns a boolean value indicating the user's choice (true for OK and false for Cancel).
180-
181-
// Example:
182-
183-
// const result = confirm('Are you sure you want to delete this item?');
184-
// if (result === true) {
185-
// console.log('Item deleted.');
186-
// } else {
187-
// console.log('Deletion cancelled.');
188-
// }
189-
// This example shows a confirm dialog asking the user if they want to delete an item. Depending on the user's choice, it logs either "Item deleted." or "Deletion cancelled." to the console.
190-
191-
192-
// Window Object, Dom & Bom
193-
194-
195-
// +---------------------------+
196-
// | |
197-
// | Window |
198-
// | |
199-
// +---------------------------+
200-
// |
201-
// | Provides access to:
202-
// |
203-
// +---------------------------+
204-
// | |
205-
// | Document Object Model |
206-
// | (DOM) |
207-
// | |
208-
// +---------------------------+
209-
// |
210-
// | Provides access to:
211-
// |
212-
// +---------------------------+
213-
// | |
214-
// | Browser Object Model |
215-
// | (BOM) |
216-
// | |
217-
// +---------------------------+
218-
// |
219-
// | Provides access to:
220-
// |
221-
// +---------------------------+
222-
// | |
223-
// | JavaScript Core |
224-
// | |
225-
// +---------------------------+
226-
227-
// DOM (Document Object Model):
228-
// The Document Object Model represents the structure of an HTML or XML document as a tree-like structure, where each element in the document is represented as a node. The DOM provides a way to interact with the content and structure of a web page using programming languages like JavaScript. The window object in JavaScript provides access to the DOM, allowing you to manipulate elements, change their attributes, and handle events. You can use methods like getElementById(), querySelector(), and properties like innerHTML to interact with the DOM through the window object.
229-
230-
231-
// Simply Dom Represent The Page Content As HTML
232-
233-
// document.body -> Page Body As JS Object
234-
// document.body.style.background="Green"
235-
// Change Page Background To Green
236-
237-
238-
// BOM (Browser Object Model):
239-
// The Browser Object Model represents the browser window or tab itself. It provides additional objects and properties that allow you to control the browser's behavior and interact with the user. The window object acts as the global object in JavaScript and serves as the entry point to the BOM. It provides properties and methods to control the browser's behavior, such as window.location to manipulate the URL, window.alert() to display alert messages, and window.open() to open new browser windows or tabs.
240-
241-
242-
// Location href = "https://dpvasani56.com" -> Redirect To Another URL
243-
136+
// While Loop Vs For Loop
137+
for (let i = 0; i < 500; i++) {
138+
console.log(233)
139+
}
140+
141+
console.timeEnd("forLoop")
142+
143+
console.time("whileLoop")
144+
145+
let i = 0;
146+
while (i < 500) {
147+
console.log(233)
148+
i++;
149+
}
150+
151+
console.timeEnd("whileLoop")
152+
153+
// List
154+
155+
// assert() -> Writes an error message to the console if a assertion is false
156+
// clear() -> Clears the console
157+
// count() -> Logs the number of times that this particular call to count() has been called
158+
// error() -> Outputs an error message to the console
159+
// group() -> Creates a new inline group in the console. This indents following console messages by an additional level, until console.groupEnd() is called
160+
// groupCollapsed() -> Creates a new inline group in the console. However, the new group is created collapsed. The user will need to use the disclosure button to expand it
161+
// groupEnd() -> Exits the current inline group in the console
162+
// info() -> Outputs an informational message to the console
163+
// log() -> Outputs a message to the console
164+
// table() -> Displays tabular data as a table
165+
// time() -> Starts a timer (can track how long an operation takes)
166+
// timeEnd() -> Stops a timer that was previously started by console.time()
167+
// trace() -> Outputs a stack trace to the console
168+
// warn() -> Outputs a warning message to the console
169+
170+
171+
// Interaction In JavaScript: Prompt, Alert, And Confirm
172+
// BOM Functions
173+
// 1. prompt -> Take Input From User
174+
175+
// Example:
176+
177+
// const name = prompt('Enter your name:');
178+
// console.log('Hello, ' + name + '!');
179+
180+
// inp = prompt("Hi", "No") -> No Is Optional Default Value
181+
182+
// This example prompts the user to enter their name and stores the entered value in the name variable. It then logs a greeting message to the console using the entered name.
183+
184+
185+
// 2. alert
186+
187+
// The alert method displays a dialog box with a message to the user. It is primarily used to show information or provide notifications to the user.
188+
189+
// Example:
190+
191+
// alert('This is an alert message.');
192+
// This example displays an alert box with the message "This is an alert message."
193+
194+
195+
// 3. confirm
196+
197+
// The confirm method displays a dialog box with a message and two buttons: OK and Cancel.It allows the user to confirm or cancel an action.It returns a boolean value indicating the user's choice (true for OK and false for Cancel).
198+
199+
// Example:
200+
201+
// const result = confirm('Are you sure you want to delete this item?');
202+
// if (result === true) {
203+
// console.log('Item deleted.');
204+
// } else {
205+
// console.log('Deletion cancelled.');
206+
// }
207+
// This example shows a confirm dialog asking the user if they want to delete an item. Depending on the user's choice, it logs either "Item deleted." or "Deletion cancelled." to the console.
208+
209+
210+
// Window Object, Dom & Bom
211+
212+
213+
// +---------------------------+
214+
// | |
215+
// | Window |
216+
// | |
217+
// +---------------------------+
218+
// |
219+
// | Provides access to:
220+
// |
221+
// +---------------------------+
222+
// | |
223+
// | Document Object Model |
224+
// | (DOM) |
225+
// | |
226+
// +---------------------------+
227+
// |
228+
// | Provides access to:
229+
// |
230+
// +---------------------------+
231+
// | |
232+
// | Browser Object Model |
233+
// | (BOM) |
234+
// | |
235+
// +---------------------------+
236+
// |
237+
// | Provides access to:
238+
// |
239+
// +---------------------------+
240+
// | |
241+
// | JavaScript Core |
242+
// | |
243+
// +---------------------------+
244+
245+
// DOM (Document Object Model):
246+
// The Document Object Model represents the structure of an HTML or XML document as a tree-like structure, where each element in the document is represented as a node. The DOM provides a way to interact with the content and structure of a web page using programming languages like JavaScript. The window object in JavaScript provides access to the DOM, allowing you to manipulate elements, change their attributes, and handle events. You can use methods like getElementById(), querySelector(), and properties like innerHTML to interact with the DOM through the window object.
247+
248+
249+
// Simply Dom Represent The Page Content As HTML
250+
251+
// document.body -> Page Body As JS Object
252+
// document.body.style.background="Green"
253+
// Change Page Background To Green
254+
255+
256+
// BOM (Browser Object Model):
257+
// The Browser Object Model represents the browser window or tab itself. It provides additional objects and properties that allow you to control the browser's behavior and interact with the user. The window object acts as the global object in JavaScript and serves as the entry point to the BOM. It provides properties and methods to control the browser's behavior, such as window.location to manipulate the URL, window.alert() to display alert messages, and window.open() to open new browser windows or tabs.
258+
259+
260+
// Location href = "https://dpvasani56.com" -> Redirect To Another URL
261+
262+
// console.log(window) => All Method
263+
// Window Object -> Global Object

0 commit comments

Comments
 (0)