// Here is an example of using YAGNI (You Ain't Gonna Need It) principle in JavaScript:// Imagine you are asked to build a simple calculator function that adds two numbers together// Using YAGNI principle, you start with the minimum required functionality without adding unnecessary complexitiesfunctionadd(a, b) {
return a + b;
}
// You resist the urge to add extra features like subtraction, multiplication, or division// as those are not part of the current requirements// By following the YAGNI principle, you keep your code simple, lean, and focused only on the current requirements// Remember, always aim to build what is required now, and avoid adding features you may not need in the future