JavaScript Programming Examples: Fibonacci, Temperature Converter, and More
JavaScript Programming Examples
Fibonacci Sequence Generator
This program generates the first N Fibonacci numbers using JavaScript.
Input: A number N obtained using prompt.
Output: The first N Fibonacci numbers.
Temperature Converter
This program converts Fahrenheit to Celsius using JavaScript.
Input: A temperature value in Fahrenheit.
Output: The equivalent temperature in Celsius.
Arithmetic Calculator
This program performs basic arithmetic operations (addition, subtraction, multiplication, division, modulus) using JavaScript.
Input: Two numbers.
Output: The result of the selected operation.
JavaScript Operators
This section explains different types of operators available in JavaScript, including arithmetic, comparison, logical, assignment, and conditional operators.
Changing Background Color Based on Time of Day
This program changes the background color of a web page depending on the time of day using JavaScript.
Perl Array Sorting and Loop Control
This section explains how to sort arrays in Perl using the sort function and the purpose of the next statement for loop control.
Perl Hashes
This section introduces hashes in Perl, which are unordered sets of key/value pairs.
Perl Random Number Generation
This program generates random integers between 1 and 10 using Perl.
JavaScript Display Methods
This section describes various methods to display data in a web page using JavaScript, including innerHTML, document.write(), window.alert(), and console.log().
Calculating Sphere Volume
This program calculates and displays the volume of a sphere based on user input for the radius using JavaScript.
Validating User Input
This program validates a four-digit number entered by the user, checking for the absence of leading zeros and ascending order of digits.
Image Resizing
This program allows the user to resize an image by entering the desired width and height, with validation for the input values.
Registration Form Validation
This program demonstrates form validation using JavaScript, checking for blank entries, valid names, age limits, email format, phone number format, and selected options.
Array Manipulation and User Interaction
This section covers adding elements to the beginning of an array using the unshift() method and creating an interactive program to display Mr. or Mrs. based on user input.
Sorting Numbers in JavaScript
This program takes a list of numbers from the user and sorts them using JavaScript.
HTML Forms and Image Swapping
This section provides examples of creating an HTML registration form and illustrating image swapping using JavaScript.
DTD and XML for Customer Data
This section demonstrates creating a DTD and XML document for storing customer data, including customer ID, name, mobile numbers, address, and credit card information.
HTML Table Creation
This section provides an example of creating an HTML table with merged cells using the colspan attribute.
Dividing Browser Window
This program divides the browser window into two horizontal sections, with the left part containing anchors that display corresponding pages on the right side.