[Bug 42248] New: Confusing JS code when testing length
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42248 Bug ID: 42248 Summary: Confusing JS code when testing length Initiative type: --- Sponsorship --- status: Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org if (!my_string.length > 0) is confusing and could be better written: if (my_string.length === 0) Found 4 occurrences: koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc: if (!row.cover_image_ids.length > 0) { koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt: if(!borrowernumbers.length > 0) { koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt: if ( ! $("#title_default").val().length > 0 ) { koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt: if ( ! content.length > 0 ) { ``` let content = "" undefined content.length 0 !content.length true !content.length>0 true 7m ago content = "foo" "foo" content.length 3 !content.length false !content.length>0 false ``` so... it works, but I am pretty sure it is not interpreted like how the author thought it would be (and I might be the author). -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42248 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #1 from David Cook <dcook@prosentient.com.au> --- Yeah that's pretty confusing haha -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org