# Debugging

Great playground in chrome console

### Most common errors

1. Thinking the value is invalid when it is actually undefined
2. Not awaiting for a promise
3. Can't do await in map/filter ft
4. Equality and booleans are jank in js
   1. `[] !== []` |  `Boolean([]) === true`&#x20;
5. Problems with variable hoisting(using value before its defined, without throwing error)

## Console

```javascript
console.log( { x }); //{ } prints it as a dict so you get the variable name
console.table([1, 2]); // log in table 
console.trace('hi'): //will do stack trace

//Can compute performace
console.time("looper");
//some op
console.timeEnd("looper"); //=> looper: 4.3ms
```

### Is something you are requiring undefined?

* Circular dependency, module.exports will just return null


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://openai.gitbook.io/code-cheatsheets/js/debugging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
