I am new to programming and I have a problem for one of my homework and I would like someone who has experience with Javascript or anyone with knowledge of programming to help me to solve this problem please.
I would like to make my function section to return 'true' only if a "filename" ends either in '.jpg' or '.jpeg. Here is the code that I have:
"use strict";
function isWebImageFriendly(filename) {
return true;
}
I have lots of photos ends with .jpg and.jpeg on my Javascript but I don't know how to write a code so that it only selects the .jpg or .jpeg type of files that I needed.
I was thinking should I write like this:
"use strict";
function isWebImageFriendly(filename) {
<form onsubmit="return isWebImageFriendly(filename);"></form>
return true;
}