Mistakes will be made and it is better the compiler/interpreter catches them early before they turn into problems. Enabling any strict modes will force you to write better code.
The following is a list of languages and how to enable additional strict modes / warnings. It is worth checking on the languages website to for more details.
For Javascript, "use strict"; should be at the start of all the programs. It forces a stricter subset of JavaScript which helps make programs more secure with less chance chance of errors.
Similar to the above, use strict; use warnings; will help flag more potential problems and help make your program more secure and maintainable by catching mistakes.
The following at the top of your source code enables constants being constant(!) and range checking : {$J-}{$R+}.
D is fairly strict by default, by putting @safe where possible, it will enable additional protections to help make sure your program is memory safe.
Many other compilers have switches to enable more thorough checking too. It may be worth looking at using a language that forces strictness by default such as C#, Go or Rust.
Updated
(31/08/2023)