Javascript debug: Difference between revisions
Jump to navigation
Jump to search
| Line 51: | Line 51: | ||
== | == Further reading == | ||
* [https://errerrors.blogspot.com/2021/04/how-to-debug-javascript.html 怎樣對 JavaScript 進行偵錯] | |||
== References == | |||
<references/> | <references/> | ||
Revision as of 14:23, 4 April 2021
<< Testing: Javascript
Steps of troubleshooting
- Were the required js fils were included?
- Was the function was conflict with different js libraries? e.g. javascript - Uncaught TypeError: $(...).tooltip is not a function - Stack Overflow
- Verify the format of JSON file if the file was used by javascript by using JSONLint - The JSON Validator tools.
- Clear or disable the browser cache[2]
- Reload the webpage again
- Switch to different network environment
methods / functions
Print message
- alert() Method: Window alert() Method equivalent: window.alert("some message...");
- Is there an equivalent for var_dump (PHP) in Javascript? - Stack Overflow
- console.log()
- Firefox
: Firebug and Logging : Firebug, 利用Firebug的console功能作JavaScript偵錯 - iT邦幫忙::IT知識分享社群 for Firefox
not work for the Firebug Lite for Google Chrome(tested version: 1.4.0.11967 ) - Chrome
: Using the Console - Chrome Developer Tools — Google Developers Enter the javascript scripts in the console ( after the > symbol) directly. - IE
v.9: Using the F12 Tools Console to View Errors and Status (Windows) / 使用 F12 工具主控台檢視錯誤和狀態 (Windows)
not IE
v.8
- Firefox
- Javascript var_dump function | Tsung's Blog
- JSON.stringify()[1] "Convert a JavaScript object into a string" [Last visited: 2017-09-11]
DOM
- 如果是進行 DOM 操作,可以將選定的 DOM 元素標上顏色,確認有選到。 ex: using .addClass() | jQuery API Documentation
Data type
- isNaN() Function, isFinite() Function, typeof variable
Browser tool
- javascript - How do I view events fired on an element in Chrome DevTools? - Stack Overflow on Chrome
Browser cache issue
tools
- The Online Lint
- JSLint,The JavaScript Code Quality Tool
- desktop editor: Sublime Text + package: JSLint[3]
- JS Bin - Collaborative JavaScript Debugging
allow to download
Further reading
References
Troubleshooting of ...
- PHP, cUrl, Python, selenium, HTTP status code errors
- Database: SQL syntax debug, MySQL errors, MySQLTuner errors or PostgreSQL errors
- HTML/Javascript: Troubleshooting of javascript, XPath
- Software: Mediawiki, Docker, FTP problems, online conference software
- Test connectivity for the web service, Web Ping, Network problem, Web user behavior, Web scrape troubleshooting
Template