가격을 숫자변수로 바꾼후 이 값을 사과 마켁 index.html 에 가격을 오름차순으로 정렬하고 싶은데 어떻게 하나요?
코드는 이렇게 작성햇더니 그냥 파이어베이스에 정렬한대로 나오는군요
(이게 index.html)const db = firebase.firestore();
db.collection('product').get().then((결과)=>{
결과.forEach((doc)=>{
console.log(doc.data())
const number = ['가격'];
number.sort((a, b) => a - b);
console.log(number);
var 템플릿 = `<div class="product">
<div class="thumbnail" style="background-image: url('${doc.data().이미지 }')"></div>
<div class="flex-grow-1 p-4">
<h5 class="title">${doc.data().제목}</h5>
<p class="date">${doc.data().날짜}</p>
<p class="price">${doc.data().가격}</p>
<p class="float-end">🤍0</p>
</div>
</div> `;
$('.container').append(템플릿)
})
})
</script>
</body>
</html>
(이게upload.html)
parseInt(가격)
var 저장할거 = {
제목 : $('#title').val(),
가격 : $('#price').val(),
내용 : $('#content').val(),
날짜 : new Date(),
이미지 : url,