click below
click below
Normal Size Small Size show me how
JS - Week 4
WTWD 310 - JavaScript
| Term | Definition | Example |
|---|---|---|
| Try-Catch Statement | A control structure used to handle exceptions (errors) in JavaScript. The try block contains code that might throw an error and the catch block contains code to handle the error if it occurs. | try { let result = riskyOperation(); console.log(result); } catch (error) { console.error('An error occurred:' error.message); } |
| Exception | An error that occurs during the execution of a program disrupting the normal flow of instructions. Exceptions can be caught and handled using try-catch statements. | try { throw new Error('Something went wrong'); } catch (error) { console.error(error.message); // Output: Something went wrong } |
| jQuery | A fast small and feature-rich JavaScript library that simplifies tasks such as HTML document traversal and manipulation event handling animation and Ajax interactions. jQuery makes it easier to write JavaScript code. | <script src=' |
| DOM Traversal | The process of navigating through the elements of the Document Object Model (DOM) to access or manipulate HTML elements. | $(document).ready(function(){$('ul li').css('color', 'red');}); |
| Event Handling (jQuery) | The process of capturing and responding to user actions (such as clicks key presses and mouse movements) using jQuery methods. | $(document).ready(function(){$('#myButton').click(function(){alert('Button clicked!');});}); |
| jQuery Selector | A syntax used to select and manipulate HTML elements based on their tag class id attributes and more. jQuery selectors are similar to CSS selectors. | $(document).ready(function(){$('.myClass').hide(); // Hides all elements with class 'myClass'}); |
| jQuery Method | Functions provided by jQuery to perform actions on selected elements such as hiding showing animating and modifying elements. | $(document).ready(function(){$('#myElement').fadeOut(); // Fades out the element with id 'myElement'}); |
| AJAX (jQuery) | A technique used to send and retrieve data asynchronously from a web server without reloading the web page. jQuery provides simple methods for making Ajax requests. | $.ajax({url: ' method: 'GET', success: function(data){console.log(data);}, error: function(error){console.error('Error fetching data:', error);}}); |