PHP & JS FRAMEWORK 1
20CSI504-PHP & JS FRAMEWORK
Module :II
Module name :JavaScript Fundamentals
Topic :Arrow Functions & Debugging in Browser
Faculty : Dr. S. Karthikeyini, AP/M.Tech CSE
PHP & JS FRAMEWORK 2
ARROW FUNCTION
• Arrow functions allow us to write shorter function syntax:
PHP & JS FRAMEWORK 3
ARROW FUNCTIONS RETURN VALUE BY
DEFAULT
• It gets shorter! If the function has only one statement, and
the statement returns a value, you can remove the
brackets and the return keyword:
PHP & JS FRAMEWORK 4
ARROW FUNCTION
• It gets shorter! If the function has only one statement, and
the statement returns a value, you can remove the
brackets and the return keyword:
5
Example
6
Example
PHP & JS FRAMEWORK 7
DEBUGGING THE BROWSER
• Debugging is the process of finding and fixing errors
within a script.
• All modern browsers and most other environments
support debugging tools – a special UI in developer tools
that makes debugging much easier.
• It also allows to trace the code step by step to see what
exactly is going on.
PHP & JS FRAMEWORK 8
CODE DEBUGGING
• Programming code might contain syntax errors, or logical
errors.
• Many of these errors are difficult to diagnose.
• Often, when programming code contains errors, nothing
will happen. There are no error messages, and you will
get no indications where to search for errors.
• Searching for (and fixing) errors in programming code is
called code debugging.
PHP & JS FRAMEWORK 9
JAVASCRIPT DEBUGGERS
• Debugging is not easy. But fortunately, all modern
browsers have a built-in JavaScript debugger.
• Built-in debuggers can be turned on and off, forcing errors
to be reported to the user.
• With a debugger, you can also set breakpoints (places
where code execution can be stopped), and examine
variables while the code is executing.
• Normally, otherwise follow the steps at the bottom of this
page, you activate debugging in your browser with the
F12 key, and select "Console" in the debugger menu.
10