Skip to content

Conversation

miorel
Copy link
Contributor

@miorel miorel commented Aug 26, 2024

@miorel miorel requested review from simona1 and elimanzo August 26, 2024 03:29
@miorel miorel force-pushed the traverse-post-order-nary branch from 3878338 to f1a4c8c Compare August 26, 2024 03:31
Copy link
Contributor

@elimanzo elimanzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Was this inspo from today's POTD 😄

@@ -2507,13 +2511,14 @@ function isNonNullish(value) {
}

function* traverseLevelOrder(root) {
if (!root) {
if (root == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question why the preference from !root vs root == null Is this to be more specific since !variable checks for any falsy values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've gone back and forth on this one. == null is more explicit, !root is more concise... Either one could be something to optimize for in library code. Today I'm feeling more explicit 😄

@miorel
Copy link
Contributor Author

miorel commented Aug 26, 2024

Yep, inspired by the PotD indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants