₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,190 members, 8,420,732 topics. Date: Friday, 05 June 2026 at 10:16 AM

Toggle theme

February30's Posts

Nairaland ForumFebruary30's ProfileFebruary30's Posts

1 2 3 4 5 6 7 8 9 10 (of 11 pages)

EducationRe: JAMB Is Not Infallible – Let Me Tell You Why by February30(m): 3:27pm On May 14, 2025
Hmm
ProgrammingJavascript “strict Mode” Explained: Avoid Common Coding Pitfalls by February30(op): 4:41pm On May 13, 2025
JavaScript is a versatile and powerful programming language, but its flexibility can sometimes lead to unintended behavior. One way to write safer and more predictable code is by using strict mode. In this blog post, we’ll explore what strict mode is, how it affects your code, and why it’s a good practice to use it.

What is Strict Mode?
Strict mode is a feature in JavaScript that enforces stricter parsing and error handling in your code. It was introduced in ECMAScript 5 (ES5) to help developers avoid common pitfalls and write more robust code. When you enable strict mode, the JavaScript engine will throw errors for actions that are otherwise silently ignored in non-strict mode.

To enable strict mode, simply add the following line at the top of your script or function:

"use strict";


Once strict mode is enabled, the JavaScript engine will enforce stricter rules, making it easier to catch mistakes and write cleaner code.

Example 1: Basic Variable Assignment (Non-Strict Mode)
Let’s start with a simple example in non-strict mode:

a = 6;

b = 4;

c = a + b;

console.log(c); // Output: 10


In this example, we create variables a, b, and c without declaring them using var, let, or const. This works in non-strict mode because JavaScript automatically creates global variables for undeclared assignments. However, this is considered bad practice because it can lead to bugs and unintended behavior. For example, if you accidentally misspell a variable name, JavaScript will create a new global variable instead of throwing an error.

Example 2: Enabling Strict Mode
Now, let’s enable strict mode and see how it changes the behavior of the same code:

"use strict";

a = 6; // Error: Uncaught ReferenceError: a is not defined

b = 4;

c = a + b;

console.log(c);


When strict mode is enabled, assigning a value to an undeclared variable (a = 6) throws a ReferenceError. This is because strict mode prevents the accidental creation of global variables. By catching these errors early, strict mode helps you write more reliable and maintainable code.

Example 3: Declaring Variables Properly in Strict Mode
To fix the error in the previous example, we need to declare the variables properly using let, const, or var:

"use strict";

let a = 6;

let b = 4;

let c = a + b;

console.log(c); // Output: 10


In this example, we declare the variables a, b, and c using let. This works perfectly fine in strict mode because the variables are properly declared before being used. Strict mode encourages better coding practices by forcing you to declare variables explicitly.

Key Takeaways
Non-Strict Mode: Allows undeclared variables, which can lead to bugs and unintended global variable creation.
Strict Mode: Prevents undeclared variables and enforces better coding practices. It throws errors for common mistakes like assigning to undeclared variables.
Always Declare Variables: Use let, const, or var to declare variables explicitly, even in non-strict mode.




Why Use Strict Mode?
Strict mode offers several benefits:

Catches Common Mistakes: Strict mode throws errors for actions that are otherwise silently ignored, such as assigning to undeclared variables or using duplicate parameter names in functions.
Prevents Accidental Globals: By requiring explicit variable declarations, strict mode prevents the accidental creation of global variables.
Enhances Security: Strict mode makes it easier to write secure code by disallowing certain unsafe actions, such as deleting variables or functions.
Prepares for Future JavaScript Versions: Strict mode ensures that your code is compatible with future versions of JavaScript by disallowing deprecated or problematic syntax.




Conclusion
Strict mode is a powerful tool that helps you write safer and more reliable JavaScript code. By enabling strict mode and following best practices like declaring variables explicitly, you can avoid common pitfalls and improve the quality of your code. Whether you’re a beginner or an experienced developer, using strict mode is a habit that will pay off in the long run.

So, the next time you write JavaScript, don’t forget to add "use strict"; at the top of your script or function. Your future self (and your teammates) will thank you!

Happy coding! 😊

Nairaland GeneralRe: Mention That One Thing People Don't Understand Until They Experience It by February30(m): 4:33pm On May 13, 2025
yusman14:
Ahhh. Really!
With 1m/month, I'm set for life provided that the economy condition remains like this, I know how to manage well.
Lol. You will understand when you experience it. Kindly return to this thread when it happens to 😆
Jobs/VacanciesRe: Where Can I Edit My NIN Details? by February30(op): 1:01pm On May 13, 2025
Typicool8:
I did mine recently and believe me when I say it took just few minutes
How fast was it?
Nairaland GeneralRe: Mention That One Thing People Don't Understand Until They Experience It by February30(m): 12:59pm On May 13, 2025
yusman14:
As regards to your first paragraph, why is it so?

Some people are very rich and when one ask them money, they won't want to help. It is not about being entitled. If I'm very rich and a relative ask for my help, knowing that the person is serious with his/her life, I'm going to give.

Imagine someone earning over 4m/month ignoring you because you asked for 20k.
You won't understand bro... It is possible to earn 5 million monthly and still feel broken broke.
Nairaland GeneralRe: Mention That One Thing People Don't Understand Until They Experience It by February30(m): 12:57pm On May 13, 2025
Sharpsharp00123:
Being broke I never understood the power of being broke till I experience it live n direct. U will just b stranded n even to see common 3k to give your wife to arrange food go hard.

Thank God things have changed, my advice for people out there is that don't run faster than your Shadow, it's good to upgrade but don't rush to it.

I had a thriving business giving me at least 10k per day but I see many of my friends doing big things n traveling abroad, na so I sell everything try travel ooo, I enter 419 mouth live n direct.....ehn no b small matter my people
Chai
Jobs/VacanciesRe: Where Can I Edit My NIN Details? by February30(op): 7:35pm On May 11, 2025
sorted

CareerRe: What Is A Comfortable Salary In Lagos? by February30(m): 4:24pm On May 11, 2025
helinues:
Even if you are earning N5m monthly, as long as you are following some yeye social conformity, it can never be enough
Deep truth. I understand this well
Jobs/VacanciesRe: Where Can I Edit My NIN Details? by February30(op): 4:19pm On May 11, 2025
Olachase:
something that I did my online with just payment fee of ₦1,500 while agent was telling me to bring ₦15,000
This must be years ago.
Jobs/VacanciesWhere Can I Edit My NIN Details? by February30(op):
Anyone into NIN business? There is an error in the spelling of my name. I need to change it before it becomes too late. Kindly reply to this post.


NB: I am in Lagos, Nigeria.
Jokes EtcRe: Nigeria Jokes Update With Ofego by February30(m): 7:56pm On May 10, 2025
njuwo:
Pastor: There is a man here.

Akpos: (Shouts from the crowd) It is me.

Pastor: I repeat, there is a man here.

Akpos: (Shouts from the crowd) It
is me and my family.

Pastor: I say there is a man here.

Akpos: (Shouts from the crowd) It
is me oooooo!!!.

Pastor: They have been sucking your blood for the past ten years.

Akpos: Eh? God forbid! It is not me oooo.
This thread deserves awards
PoliticsRe: Soludo, Obi Clashed Amid Tinubu’s Anambra Visit by February30(m): 6:20pm On May 10, 2025
PoliticsRe: Not Studying Journalism Formally Doesn’t Stop One From Becoming A Journalist by February30(m): 6:17pm On May 10, 2025
EhisChelsea1:
In same light, if one can argue very well, read andd understand the constitution, have persuasive skills, he can wear a suit and wig and go work in the court as a lawyer.

Also, if one is good at caring for the sick and needy, pays attention to details, do not feel repelled by the sight of blood and injuries, have a good understanding of the human body - such a one can put on a white gown, pick up a stethoscope and go work in the hospital as either a doctor or a nurse. They don’t really need to go through a formal training in a law school or medical school
So true bro, even if you sound ironic.

The only limitations are the limitations set by the society one belongs to.
TV/MoviesRe: Which Movie Comes To Mind? by February30(m): 2:15pm On May 09, 2025
Isakaba!
RomanceRe: ‘’I Am Not In School, No Business, No Relationship’ - Nigerian Lady Cries by February30(m): 4:13pm On May 05, 2025
Jagermeister:
She no get job but she can smoke weed
I think say na only me see lips..
CrimeRe: Couple Arrested For Locking Children Indoors Since 2021 Over COVID Fears (Pics) by February30(m): 4:10pm On May 05, 2025
tobore4u:
No matter what u do in life, flee from all form of gambling.
lol........stay motivated bro.
WebmastersRe: Please Advise, My Wordpress Website Is Very Slow. by February30(m): 4:03pm On May 05, 2025
Less plugins, simple wp template will do the job.
Christianity EtcRe: Water Elements And 'Water Children' by February30(m): 7:21pm On May 02, 2025
drjoe01:
cry omo omi(marine daughters)truely exist b'cos my wife is a typical example. though i was inform b4 i marry her but there are good and bad side which i 'll love to share.
DrJoe, I have to awake this after 10 years. Pls, let's talk about it.
RomanceRe: 5 People You Shouldn't Get Married To When you are in courting - Counsellor(vid) by February30(m): 2:04pm On May 01, 2025
Kobojunkie:
undecided If a woman told her husband his friends were bad... what would you think in that situation? undecided
In a home, spouses can advise each other about their friends. Nothing wrong!
RomanceRe: 5 People You Shouldn't Get Married To When you are in courting - Counsellor(vid) by February30(m): 7:03pm On Apr 30, 2025
press9jatv:
she’s very right here
But, tell me why my husband would not tell me if my female friends are bad 😔?

Her ideas needs balance.
RomanceRe: 5 People You Shouldn't Get Married To When you are in courting - Counsellor(vid) by February30(m): 5:31pm On Apr 30, 2025
press9jatv:
5 people you shouldn't get married to when you are courting heading to marriage - Nigeria female marriage counsellor speak 🗣️


https://www.youtube.com/watch?v=36Y4pUCuF4U?si=J4BEKnajg_rCm8ND
All the 5 points get as e be.
RomanceRe: Is It Shameful For A Woman To Beg A Man For Sex? by February30(m): 10:53am On Apr 29, 2025
No...


It is also not wrong for the man to say NO!
Christianity EtcRe: Christianity Etc Section And No More Oaths by February30(m): 1:53pm On Apr 27, 2025
Thanks
Nairaland GeneralRe: Update #2 On The Bot Ban Crisis On Nairaland: Refocusing by February30(m): 4:22pm On Apr 23, 2025
Seun:
Dear Nairalanders,

I want to thank you for your continued feedback and patience as we tackle the crisis caused by our decision to use the antispam bot to enforce more rules on Nairaland. While the action helped us to tackle many chronic issues, it also led to disastrous ban of hundreds of innocent Nairalanders. To significantly improve accuracy, the bot will avoid moderating complex issues that require human nuance.

While we work on further improvements, here are some tips to ensure your posts don't accidentally trigger the bot:
- Keep your posts related to the thread topic.
- You can disagree strongly with fellow Nairalanders, but do not insult them.
- Don't put any type of obscene content on Nairaland.
- Do not encourage or call for violence against anyone.
- Don't spam or try to scam Nairalanders. We will not tolerate this.
- Don't illegally upload or post links to illegally download copyrighted music, movies, games, or software.

We believe these changes are a significant step towards a better balance.

Thank you for being part of Nairaland.

Best Regards,
Seun Osewa.
Thanks 🙏

Bots should be monitored
Nairaland GeneralRe: What Does Nairaland Need Right Now? by February30(m): 9:11am On Apr 15, 2025
Seun:
Hello Guys,

I'm throwing this question to you because it's very important. Every time I ask, "how is Nairaland?" I'm told that it is fine. If I ask what are the challenges I'm told there are none.

So I need to talk to you guys directly about what you think is going on and what you want us to do. I have not had the confidence to make major changes on Nairaland. I have a little confidence now because of AI.

What are your complaints, your challenges, your issues. What are the things that can drive people away and need to be nipped?

Speak your mind, but don't be rude. Thanks.
Nairaland should be made to work well with markdowns. Check medium..com. and also NL should also be free with link sharing... These open rules allows everyone in.. thereby keeping the system independent.
WebmastersRe: Customer Support Is The Backbone Of Every Great Hosting Company by February30(m): 4:53pm On Apr 11, 2025
100% true!
ProgrammingRe: Mtn Data Deal: 1g/300. 2g Or More/250 by February30(m): 9:59am On Apr 04, 2025
Firebox123:
😁😂

Shey na so you dey do on opay and your bank be that when you wan buy data abi
this feels like scam na....too good to be true bro
ProgrammingRe: `...`: Rest Or Spread? Demystifying The Operators For Budding Programmers! by February30(op): 9:57am On Apr 04, 2025
Macjabbur:
Mtn data deal - 1g/N300, 2g+: N250
Whatsap: 08163074704
Where do you get urs?
PhonesRe: Telegram Quietly End Supports For Older Android Operating System by February30(m): 9:56am On Apr 04, 2025
Blurryface:
What's telegram?
if you are still alive...now you should know!

1 2 3 4 5 6 7 8 9 10 (of 11 pages)