### 1. `console.dir()`
#### What It Does:
`console.dir()` displays an interactive list of the properties of a specified JavaScript object. This method is useful for inspecting objects in detail.
#### Example:
```javascript
console.dir(["apples", "oranges", "bananas"]);
```
#### Output:
```
Array(3)
0: "apples"
1: "oranges"
2: "bananas"
length: 3
```
This output provides a detailed view of the array's contents and properties.
### 2. `console.table()`
#### What It Does:
`console.table()` displays tabular data as a table in the console. It can take an array of objects or an array of arrays.
#### Example:
```javascript
console.table(["apples", "oranges", "bananas"]);
```
#### Output:
```
┌─────────┬──────────┐
│ (index) │ Values │
├─────────┼──────────┤
│ 0 │ "apples" │
│ 1 │ "oranges"│
│ 2 │ "bananas"│
└─────────┴──────────┘
```
This output provides a clear tabular view of the array's elements.
### 3. `console.group()`
#### What It Does:
`console.group()` creates a new inline group in the console. Subsequent console messages will be part of this group until `console.groupEnd()` is called. It can be used for better organization of console output.
#### Example:
```javascript
console.group('Fruits');
console.log('apples');
console.log('oranges');
console.log('bananas');
console.groupEnd();
```
#### Output:
```
Fruits
apples
oranges
bananas
```
This output groups the log messages under the "Fruits" label.
### 4. `console.time()` and `console.timeEnd()`
#### What It Does:
`console.time()` starts a timer you can use to track how long an operation takes. `console.timeEnd()` stops the timer and logs the elapsed time in milliseconds.
#### Example:
```javascript
console.time('Timer');
for (let i = 0; i < 1000000; i++) {} // A simple loop to create a delay
console.timeEnd('Timer');
```
#### Output:
```
Timer: 1.234ms
```
This output shows the time taken by the loop to execute.
### 5. `console.clear()`
#### What It Does:
`console.clear()` clears the console if possible. This method is useful for removing all previous messages from the console to start fresh.
#### Example:
```javascript
console.log('This will be cleared');
console.clear();
console.log('Console is cleared');
```
#### Output:
```
Console is cleared
```
After `console.clear()` is called, the previous log "This will be cleared" is removed, leaving only the "Console is cleared" message.
---
### Summary
- **`console.dir()`**: Inspect objects in detail.
- **`console.table()`**: Display data in a tabular format.
- **`console.group()`**: Group log messages.
- **`console.time()` & `console.timeEnd()`**: Measure execution time.
- **`console.clear()`**: Clear the console.