JavaScript-7

김민성·2023년 3월 17일

JavaScript

목록 보기
7/8
post-thumbnail

const quotes = [
    {...
];

const quote = document.querySelector("#quote span:first-child");
const author = document.querySelector("#quote span:last-child");

const todayQuote = quotes[Math.floor(Math.random() * quotes.length)]

quote.innerText = todayQuote.quote
author.innerText = todayQuote.author;
  • 이 코드는 hello nico 아래에 있는 문자를 랜덤하게 바꾸는 함수이다.
profile
처음부터 다시 기본부터 잡아보자

1개의 댓글

comment-user-thumbnail
2023년 3월 20일

금요일은 즐기규~

답글 달기