[英]Is there an alternative to console.log() which lets you print out and update a single line instead of spamming the console?
[英]Is there a way for console.log() to update a line instead of appending new ones?
如果我想跟蹤一個經常更新的變量,可以執行console.log(myVar);
,在控制台底部添加一行:
有沒有辦法替換最后一行的值,而不是在底部添加新行?
這將非常有幫助,因為這樣我就可以查看以前的日志,而不必滾動到頂部。
我嘗試了以下方法:
console.clear();
console.log(myObject);
console.log(myVar);
但這是行不通的,因為重新記錄對象會使它們折疊,並且在Chrome中閃爍太多。 我在控制台上閱讀了MDN文檔 ,即使它具有許多簡潔的功能,我也想不出如何重寫一行代碼。 我已經在終端/命令提示符中看到它完成了,瀏覽器控制台是否具有該功能?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.