Nikola Brežnjak blog - Tackling software development with a dose of humor
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Home
Daily Thoughts
Ionic
Stack Overflow
Books
About me
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Nikola Brežnjak blog - Tackling software development with a dose of humor
Daily Thoughts, JavaScript

const life = change();

They (supposedly, originally, Heraclitus) say that the only true constant in life is change.

A JavaScript programmer in you might write that like this:

const life = change();

And, the trick in real life is that the function’s implementation regularly looks like this:

function change() {
    return Math.random();
}

However, when you’d try to output the value of the life constant (see it in action in JS Fiddle), it would be exactly that, a constant (no matter how many times you’d call it or output it).

Sidenote: if you’re puzzled by the fact that you can assign a function to a constant (or to a variable for that matter) before it was defined in the code, then go and learn about hoisting in JavaScript.

Now, you may write the above statement like this:

const life = function change() {
    return Math.random();
}

Now, if you call the life function (again, see it in action), it will return a different value every time you call it.

⚠️ JavaScript gurus among you may chuckle at assigning a function to a constant, but check this StackOverflow answer for its applicability – plus, you’ll learn (or, refresh your memory) about hoisting in JS.

Switching gears; the point of all this is that you can’t expect to be doing the same thing, and getting different results, and no matter what obstacles you face, the key to overcoming them is not in changing the event, but in changing yourself and how you react to it. And that itself is a process. A process that begins with the desire or acceptance to be teachable and improve for the better.

Hope you like this attempt at mixing programming with personal growth topics (for more, check my daily thoughts entries).

Stay safe, friends ❤️


This is why I write these ‘daily thoughts’ posts.

Daily Thoughts

Helping others

In the case of an air pressure type emergency on the ✈️, before helping others you should put the mask on first. The same goes for helping others in any other way; help yourself first. How can you help someone with something if you yourself don’t yet know the best way of doing that something?


This is why I write these ‘daily thoughts’ posts.

Daily Thoughts

The curious case of tomorrow

This may come as a shock to learn that (as reported here – and there are many similar reports, just Google them):

Fewer than 1 in 100 stroke survivors met all seven heart-health goals identified by the American Heart Association. And just 1 in 5 met four of those goals.

James Clear wrote the other day:

If you’d like to do something bold with your life, you will have to choose to do something bold on a specific day. There is no perfect day. There is no right time. For the trajectory to change, there has to be one day when you simply make the choice.

So, I really wonder, how sick and tired of something we need to be in order to change that something for the better?

Instead of waiting for tomorrow, why not start today?


This is why I write these ‘daily thoughts’ posts.

Daily Thoughts

Filter Bubbles

Filter bubbles have a task to keep you engaged consuming instead of increasing your education or quality of life.


This is why I write these ‘daily thoughts’ posts.

Daily Thoughts

Going all in

Don’t expect much from x, if you’re just half-assing your commitment to it. Whatever the x may be. Go all in!


This is why I write these ‘daily thoughts’ posts.

Daily Thoughts

Unsocial media

Social media is all but making us social these days.


This is why I write these ‘daily thoughts’ posts.

Daily Thoughts

Would money change you?

It would be an interesting experiment to let every person on this planet win a lottery and see which behavior it amplifies in them?


This is why I write these ‘daily thoughts’ posts.

Daily Thoughts

Now what!?

Even when I wrote that we seemingly haven’t learned anything, and that the war should never be the solution, I still didn’t believe that it would come to today’s “news”. I thought that we, as a species, have grown above such behaviors. I only wonder where this ends, and feel sorry for all the innocent humans (on both sides) :/


This is why I write these ‘daily thoughts’ posts.

Daily Thoughts

Until when should you persevere?

There are multiple quotes around perseverance (and images similar to the one in the post), and I’m all for it because I tend to believe most people give up too soon. However, until when should you be pivoting (fancy word for failing)? Until your run rate goes dry, until Nth pivot, until x event? What are the N and/or x?


This is why I write these ‘daily thoughts’ posts.

Daily Thoughts

Growing up

The greatest day in your life and mine is when we take total responsibility for our attitudes. That’s the day we truly grow up. ~ John Maxwell

This one really hits home – what ‘thing’ are you blaming on your circumstances, instead of taking the responsibility?


This is why I write these ‘daily thoughts’ posts.

The greatest day in your life and mine is when we take total responsibility for our attitudes. That’s the day we truly grow up. ~ John Maxwell https://t.co/50CPIwkA8Q

— Nikola Brežnjak (@HitmanHR) February 22, 2022

Page 2 of 8«1234»...Last »

Recent posts

  • When espanso Breaks on Long Replacement Strings (and How to Fix It)
  • 2024 Top Author on dev.to
  • Hara hachi bun me
  • Discipline is also a talent
  • Play for the fun of it

Categories

  • Android (3)
  • Books (114)
    • Programming (22)
  • CodeProject (36)
  • Daily Thoughts (78)
  • Go (3)
  • iOS (5)
  • JavaScript (128)
    • Angular (4)
    • Angular 2 (3)
    • Ionic (61)
    • Ionic2 (2)
    • Ionic3 (8)
    • MEAN (3)
    • NodeJS (27)
    • Phaser (1)
    • React (1)
    • Three.js (1)
    • Vue.js (3)
  • Leadership (1)
  • Meetups (8)
  • Miscellaneou$ (78)
    • Breaking News (8)
    • CodeSchool (2)
    • Hacker Games (3)
    • Pluralsight (7)
    • Projects (2)
    • Sublime Text (2)
  • PHP (6)
  • Quick tips (41)
  • Servers (8)
    • Heroku (1)
    • Linux (3)
  • Stack Overflow (81)
  • Unity3D (9)
  • Windows (8)
    • C# (2)
    • WPF (3)
  • Wordpress (2)

"There's no short-term solution for a long-term result." ~ Greg Plitt

"Everything around you that you call life was made up by people that were no smarter than you." ~ S. Jobs

"Hard work beats talent when talent doesn't work hard." ~ Tim Notke

© since 2016 - Nikola Brežnjak