Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

II not checking both possibilities

My code includes the following-

 if(!code1.startsWith(("<video" || "<img"))){return ...}

The code only checks if code1 doesn’t start with "<video". If the "<video" is false and "<img" is true, it executes the return code.
I am still a learner and hoping for help.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

it is not supposed to behave like that; but you can achieve it this way:

if (!(code1.startsWith("<video") || code1.startsWith("<img"))) {
    return ...
}

The code above checks that code string NEITHER starts with <video NOR
<img – so if it starts with either, return …

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading