Use Helper Functions for Reusable Logic
এই দিনের কাজ · মোট ১০′০/১ (০%)
- Use Helper Functions for Reusable Logic — নিচের Incorrect কোড পড়ে, না দেখে ঠিক সংস্করণটা লিখুন; তারপর "কেন" ইংরেজিতে ২–৩ বাক্যে জোরে বলুন, আর খাতায় এক লাইন: নিজের কাজে এটা কোথায় দেখেছেন
Incorrect (logic duplicated in components):
// app/components/user-card.js class UserCard extends Component { get formattedDate() { const date = new Date(this.args.user.createdAt); const now = new Date(); const diffMs = now - date; const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); if (diffDays === 0) return 'Today'; if (diffDays === 1) return 'Yesterday'; if (diffDays < 7) return `${diffDays} days ago`; return date.toLocaleDateString(); } } // app/components/post-card.js - same logic duplicated! class PostCard extends Component { get formattedDate() { // Same implementation... } }১০′🔁 ঝালাই হবেimpact · LOW-MEDIUMCorrect: আগে নিজে লিখুন
দিন শেষে — নিজেকে যাচাই
না দেখে ঠিকটা লেখা, আর "কেন" ইংরেজিতে জোরে বলা হয়েছে?
উত্তরের আগে উপরের কাজ না দেখে মনে করুন এই দিনে কী কী করেছেন। 🧠 Test yourself