본문 바로가기

Java Script8

Weather 8.0 Geolocation 1. function navigator.geolocation.getCurrentPosition() 1) getCurrentPosition(argument1, argument2) (argument1) the function that will be called if everything is okay. (argument2) the function that will be called if there is an error. 2) Declare function for getCurrentPositionfunction onGoeOk(){}, functiononGeoError(){}function onGoeOk(position){    const lat = position.coords.lat.. 2024. 8. 31.
To do list (2) 7.6 Deleting To Dos part1problem - We don't know which todo text to delete in the databasegoal 1 - Give this todos a sort of ID ex: [{id:121212, text:"drink"}] 1) Create the objectconst newTodoObj = {   text: newTodo,   id: Date.now(),}  * Date.now()-> the function that you can call. It gives you the milliseconds the second everything. 2) Push newTodoObj into toDos arraytoDos.push(newTodoObj); 3.. 2024. 8. 29.
To do list (1) 7.0 Setup 1) add and in html2) make const toDoForm/toDoList by using getElementByIdconst toDoForm = document.getElementById("todo-form");const toDoInput = document.querySelector("#todo-form input")const toDoList = document.getElementById("todo-list"); 3) make a function 'handleToDoSubmit'  - delete event setting ->  event.preventDefault(); 4) change the value to empty.function handleToDoSubmit.. 2024. 8. 28.
Quotes 6.0 QuotesTo make Random Quotes, create forntend by HTML Randomness console.log(quotes[10]We need function that can give us number 9 to 0. 1) To get the number 0~9Math.random() * 10 2) To remove float numbersMath.round (반올림)Math.ceil (올림)(1.01 -> 2, 1.0 -> 1.0, 1.1->2)Math.floor (내림)  console.log(quotes[Math.floor(Math.random() * quotes.length)]);(1) const todaysQuote = quotes[Math.floor(Math.ra.. 2024. 8. 27.