The fact is
You can eat whatever you want and lose weight.
It's all about energy balance.
If you eat more calories than what your body can burn in a day, you'll be putting on weight.
If you eat a 1,200 kcal burger meal and drink a couple of beers, you probably shouldn't really be having anything else during the day if you're aiming for weight loss.
It's all about balance.
If you over eat today, you'll need to take it easier over the next couple of days and you'll be ok. It is, however, completely possible for your diet to consist of just crisps, chocolate and fizzy drinks - while you still lose weight. You'll just need to eat fewer calories that what your body can burn. With such poor quality food it's not a lot of food though.
Also, for your health's sake it's obviously always better to choose your food wisely - ideally you'd get plenty of protein, some good fats (avocado, oily fish, nuts...) and quality carbs in you every day.
"Dirty food" (the kind that makes you fat easily) is very nutrition dense (lots of kcal in a small amount) and doesn't keep you full for very long. And that's why so many of us struggle with weight control.