console.log() :-
- यह JavaScript का एक मेथड है जो डिबगिंग (debugging) के लिए उपयोग होता है।
- यह संदेशों या वेरिएबल्स की वैल्यू को ब्राउज़र के कंसोल (console) में प्रिंट करता है।
- इससे पेज पर कोई बदलाव नहीं होता, केवल डेवलपर टूल्स (F12) में देखा जा सकता है।
- यह alert() की तरह यूजर को रोकता नहीं है, इसलिए टेस्टिंग के लिए ज्यादा उपयुक्त है।
syntax:-
<!DOCTYPE html>
<html>
<body>
<script>
console.log("Hello World!");
</script>
</body>
</html>
console.log() :
- This is a JavaScript method used for debugging.
- It prints messages or variable values to the browser's console.
- It does not cause any changes on the page; it can only be seen in the developer tools (F12).
- Unlike alert(), it does not block the user, making it more suitable for testing.
syntax:-
<!DOCTYPE html>
<html>
<body>
<script>
console.log("Hello World!");
</script>
</body>
</html>