This repository contains several projects that I created while following tutorials to enhance my programming skills and learn new concepts. Below is an overview of the projects included and what I learned while building them.
This is a simple and fun game where the player competes against the computer in a classic game of Rock, Paper, Scissors.
- JavaScript Functions: I learned how to write reusable functions to handle game logic, including determining the winner based on player and computer choices.
- Dynamic HTML Manipulation: Using JavaScript to update the HTML document dynamically, such as displaying the results and updating scores.
const playGame = (userChoice) => {
//generste computer choice
const compChoice = genComChoice();
if(userChoice === compChoice){
// this function will print the if the game is draw
drawGame();
} else {
userWin = true;
if(userChoice === "rock"){
//scissor, paper
userWin = compChoice === "paper" ? false : true;
} else if(userChoice === "paper"){
userWin = compChoice === "scissors" ? false :true;
} else {
userWin = compChoice === "rock" ? false :true;
}
showWinner(userWin,userChoice,compChoice);
}
};This project is a web application that allows users to convert amounts between different currencies using live exchange rates.
- Fetching APIs: I learned how to fetch live data from an API and integrate it into a web application.
- Asynchronous JavaScript: Using
asyncandawaitto handle asynchronous operations effectively. - Error Handling: Debugging and solving issues like undefined values and API errors.
- Responsive Design: Ensuring the application works well on different screen sizes.
const updateExchangeRate = async () => {
let amount = document.querySelector(".amount input");
let amtVal = amount.value;
if(amtVal === "" || amtVal < 1){
amtVal =1;
amount.value = "1";
}
const URL = `${base_URL}/${fromCurr.value}`;
let response = await fetch(URL);
let fromCurrData = await response.json();
let toCurrRate = fromCurrData.conversion_rates[toCurr.value];
let finalAmount=amtVal*toCurrRate;
msg.innerText = `${amtVal} ${fromCurr.value} = ${finalAmount} ${toCurr.value}`
}I plan to create more projects to deepen my understanding of JavaScript and explore advanced concepts. Some ideas include:
- To-Do List App: To learn about CRUD operations and local storage.
- Weather App: To integrate APIs and display live weather data.
- Quiz Application: To enhance logic-building skills and UI design.
Stay connected and follow my journey:
- Twitter: @learnwithkhushi
- GitHub: Khushi Nagaliya