Skip to content
Merged
File renamed without changes.
File renamed without changes.
53 changes: 53 additions & 0 deletions Students/kamala/dom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<title>Color Change</title>
<style>
body {
background-color: white;
text-align: center;
margin-top: 100px;
}

button {
padding: 10px 20px;
font-size: 18px;
background-color: blue;
color: white;
border: none;
cursor: pointer;
}
</style>
</head>

<body>

<button onclick="changeColor()">Click Me</button>

<script>
// Colors list
const bgColors = ["black", "red", "blue"];
const btnColors = ["red", "black", "green"];

let index = 0;

function changeColor() {
// Change background color
document.body.style.backgroundColor = bgColors[index];

// Change button color
const btn = document.querySelector("button");
btn.style.backgroundColor = btnColors[index];

// Move to next color
index++;

// Reset index when it reaches end
if (index >= bgColors.length) {
index = 0;
}
}
</script>

</body>
</html>
48 changes: 46 additions & 2 deletions Students/kamala/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,54 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width= , initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.btn{
padding: 10px 20px ;
}


</style>
</head>
<body>
<a href="https://www.google.com" target="_blank">google</a>
<button class = "btn" style="background-color: blue;">click me</button>
<script>
a
const btn = document.querySelector(".btn");
console.log(btn.innerText);
btn.innerText += "click";
console.log(btn.innerText);
console.log(btn.innerText.style.backgroundColor);
btn.style.color ="green";
const youtube=document.querySelector('a');
console.log(youtube);
youtube.href="https://www.youtube.com/";
youtube.textContent="youtube";
console.log(youtube);
</script>

</body>
</html>
</html>

<!-- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<a href="https://www.google.com" target="_blank">google</a>
<script>

const change=document.querySelector('a');
console.log(change);
change.href="https://www.youtube.com/";
change.textContent="youtube";
console.log(change);
</script>
</body>
</html> -->
84 changes: 84 additions & 0 deletions Students/kamala/index1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<!DOCTYPE html>
<html>
<head>
<title>Todo List</title>
<style>
body{
font-family:Arial;
background:#f4f4f4;
display:flex;
justify-content:center;
margin-top:50px;
}

.container{
background:white;
padding:30px;
width:400px;
border-radius:10px;
box-shadow:0 0 10px gray;
}

input{
width:70%;
padding:10px;
}

button{
padding:10px;
}

ul{
padding:0;
list-style:none;
}

li{
margin-top:10px;
background:#ddd;
padding:10px;
display:flex;
justify-content:space-between;
}

.delete{
background:red;
color:white;
border:none;
}
</style>
</head>
<body>

<div class="container">
<h2>To Do List</h2>

<input type="text" id="task">
<button onclick="addTask()">Add</button>

<ul id="list"></ul>
<!-- Tasks will appear here = -->
</div>

<script>
function addTask(){

let task=document.getElementById("task").value;

if(task==""){
alert("Enter task");
return;
}

let li=document.createElement("li");
li.innerHTML=task +
'<button class="delete" onclick="this.parentElement.remove()">Delete</button>';

document.getElementById("list").appendChild(li);

document.getElementById("task").value="";
}
</script>

</body>
</html>
17 changes: 17 additions & 0 deletions Students/kamala/learn1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const learn={
name: "Sita",
age: 20,
cources : ["python","ML","Django"],"present days":['sun','mon','tue']
};
//update cources
learn.cources=["UI/UX",'Development']
//add new property
learn.grade="class2"

const info={
name:"Ram",
grade:"class4"
}
console.log({...learn, ...info});

// console.log(learn);
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions Students/kamala/learn4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// const letslearnUsersArray=[{
// name:"saugat Bagale",
// age:23,
// isLogin:true
// },{
// name:"Nishant",
// age:24,
// isLogin:false
// },
// {
// name:"Aakriti",
// age:22,
// isLogin:true
// },
// {
// name:"subin",
// age:19,
// isLogin:false
// },
// {
// name:"kamala",
// age:19,
// isLogin:true
// },
// {
// name:"suman",
// age:19,
// isLogin:false
// },

// ];
// for (let user of letslearnUsersArray) {
// console.log(user.name);
// }
const MarbalHeros = ["Iron Man","Captain America","Thor","Hulk","Black Widow","Hawkeye"];

function concactHeros(value){
for (const hero of object.values(value)) {

console.log(hero);
}
}

concactHeros(MarbalHeros);
24 changes: 24 additions & 0 deletions Students/kamala/learn5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// const studentScores =[
// 10,85,92,78,88,95,80
// ];
// const total=studentScores.reduce(function(total,current){
// console.log("value:",total,current)
// return total+ current
// },0);
// console.log("Total Marks Sum :",total)

// for in use
const array={
name:"Adhikari", age:20,email:"adhikari@gmail.com"
}
for (const key in array){
console.log(array[key])
}
// for of use

const array2={
name:"Adhikari", age:20,email:"adhikari@gmail.com"
}
for (const [key, value] of Object.entries(array2)) {
console.log(key, value)
}
File renamed without changes.
103 changes: 88 additions & 15 deletions Students/kamala/task2.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,90 @@
const learn={
name: "Sita",
age: 20,
cources : ["python","ML","Django"],"present days":['sun','mon','tue']
};
//update cources
learn.cources=["UI/UX",'Development']
//add new property
learn.grade="class2"

const info={
name:"Ram",
grade:"class4"
// Recommended Task: "The E-Commerce Inventory Manager"
// Objective:
// Build a system to manage products in a store using functions to automate tasks and objects to store complex data.


// Create an empty array called inventory.
let inventory=[]

// Create a function called createProduct(name, price, quantity).
// This function should return an object with those three properties.
// Call this function three times to create these items and add them to your inventory array:
// "Laptop", 1200, 10
// "Mouse", 25, 50
// "Keyboard", 100, 20
function createProduct(name, price, quantity){
let products= {
"name":name,
"price":price,
"quantity":quantity
};
return products

}

let p1=createProduct("Laptop",1200,10)
let p2=createProduct("Mouse",25,50)
let p3=createProduct("Keyboard",100,20)

inventory=[p1,p2,p3]//all data was overridden by `p3

// Updating Data (Accessing Constraints)

// Oh no! The "Mouse" price was wrong. Access the second item in your inventory array and update its price to 30.
// Access the "Laptop" (first item) and add a new property category with the value "Electronics".
inventory[1].price=30
console.log("After increasing mouse price",inventory)

// Access the "Laptop" (first item) and add a new property category with the value "Electronics".
// Merging Product Details (Spread Operator):
inventory[0].category="Electronics"
console.log("After adding the category on p1",inventory)
// Create an object called extraDetails with { warranty: "2 years", color: "Silver" }.
// Create a new variable updatedLaptop by merging the first item in your inventory with extraDetails using the spread operator (...).
// Console log updatedLaptop to see the combined result.

const extraDetails={
warranty:"2 years",
color:"Silver"
}

let updatedLaptop={...inventory[0],...extraDetails}
console.log(updatedLaptop)

// The Sale Function (Arrow Functions):

// Write an Arrow Function called calculateTotalValue.
// It should accept two parameters: price and quantity.
// It should return the total value (price * quantity).
// Use this function to calculate the total value of the "Keyboard" stock (from your inventory) and log it.

const calculateTotalValue=(price,quantity)=>{
return (price*quantity)
}
console.log({...learn, ...info});
const totalValOfKeyboard=calculateTotalValue(inventory[2].price,inventory[2].quantity)
console.log("The total value of Keyboard is",totalValOfKeyboard)

// Nested Data Challenge:

// Create a user object called adminUser with:
// name: "Manager"
// permissions: A nested object { canEdit: true, canDelete: false }
// Write an if statement: If adminUser.permissions.canEdit is true, console log "Access Granted: Inventory updated."
// Why this works:
// Functions: They practice passing arguments (name, price) effectively.
// Objects: They learn to store grouped data instead of just single variables.
// Spread: Real-world use case (adding extra specs to a product).
// Nested Access: Reviewing how to dig into data (user.permissions.canEdit).

const adminUser={
name:"Manger",
permissions:{
canEdit:true,
canDelete:false
}
}

if (adminUser.permissions.canEdit ===true){
console.log("Access Granted: Inventory updated!!!!")

// console.log(learn);
}
Loading
Loading