I am noob in java script .Just made a small project that generates quotes.
But i want that that the name of the person who gave the quote should be in next line and right aligned but cant figure out how to do that in an array line breaker tag does not work.
HTML
<body>
<div class="container">
<div class="container-fluid">
<button type="button" class="btn btn-success">Generate Quote</button>
<div class="row">
<div class="col-lg-12">
</div>
</div>
</div>
</div>
<script src="index.js" async defer>
</script>
</body>
JS
let quotes=["I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.","You only live once, but if you do it right, once is enough."];
let btn=document.querySelector(".btn");
let adding=document.querySelector(".col-lg-12");
btn.addEventListener("click",function(){
let myQuote=quotes[getRandomNumber()];
adding.textContent=myQuote;
})
console.log(getRandomNumber());
function getRandomNumber(){
return (Math.floor(Math.random()*quotes.length))};
Thank You For your precious time!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…