FULL STACK WEB DEVELOPMENT Java Script
FULL STACK WEB DEVELOPMENT Java Script
#3 Visual Studio Code Setting up Visual Studio code for running JavaScript Install NodeJS https://nodejs.org/en/download/current
Variable
Operator
Arrays
RULE Object
#2
then
go to different programming
Var
Let
Const
Variables
#3 let name = "John";
const age = 30;
var isStudent = true;
let numbers = [1, 2, 3, 4, 5];
Ex let person = { name: "Alice", age: 25 };
function greet(name)
{
return "Hello, " + name + "!";
}
if (num > 0) {
console.log("Positive number");
} else if (num < 0) {
console.log("Negative number");
} else {
console.log("Zero");
if, else, else if }
// JavaScript
Events
document.getElementById("btn").addEventListener("click", function() {
#8
console.log("Button clicked!");
});
// Callback example
function fetchData(callback)
{
setTimeout(function()
{
callback("Data received");
}, 2000);
}
FULL STACK WEB
fetchData(function(data)
DEVELOPMENT Java Script {
console.log(data);
});
Asynchronous JavaScript:
Understand asynchronous programming
#9
with callbacks, promises, and async/await.
try
{
// Code that might throw an error
}
catch (error)
{
console.error("An error occurred:",
error);
}
finally
{
console.log("Cleanup code");
Error Handling }
#10
<script>
window.onload = function() {
alert("Welcome to Sanjay's Personal Website!");
};
an alert when the page loads, welcoming </script>
#1 the user to your website
<script>
function changeBackgroundColor() {
// Generate a random color
changes the background color of the
var randomColor = '#' + Math.floor(Math.random()*16777215).toString(16);
#2 page when the user clicks a button
<div id="datetime"></div>
<script>
function displayDateTime() {
var currentDate = new Date();
var dateTimeString = "Current Date and Time: " + currentDate.toLocaleString();
dynamically displays the current date and document.getElementById("datetime").textContent = dateTimeString;
#3 time on your website }
// Call the function to display date and time when the page loads
window.onload = function() {
displayDateTime();
};
</script>
Icons https://icon-icons.com/
Webp https://tiny-img.com/webp/
html https://htmlcheatsheet.com/
https://css-tricks.com/snippets/css/a-guide-
Flex to-flexbox/
Tutorial https://css-
tricks.com/snippets/css/complete-guide-
Grid grid/