You are here: PSPad forum > English discussion forum > javascript pspad problem

javascript pspad problem

#1 javascript pspad problem

Posted by: Gabriel_ACE | Date: 2019-02-11 15:30 | IP: IP Logged

hi!

I m trying to execute this sentence

var oneFile = moreFiles.item();
var n = oneFile.search(".sel");
echo(n);

but pspad don't like "search"

idem for "includes"

var oneFile = moreFiles.item();
var n = oneFile.includes(".sel");
echo(n);

I don't understand which is the problem

Options: Reply | Quote | Up ^


#2 Re: javascript pspad problem

Posted by: pspad | Date: 2019-02-11 15:53 | IP: IP Logged

What does mean "pspad doesn't like search"?

Options: Reply | Quote | Up ^


#3 Re: javascript pspad problem

Posted by: vbr | Date: 2019-02-11 21:56 | IP: IP Logged

Gabriel_ACE:
hi!

I m trying to execute this sentence

var oneFile = moreFiles.item();
var n = oneFile.search(".sel");
echo(n);

but pspad don't like "search"

idem for "includes"

var oneFile = moreFiles.item();
var n = oneFile.includes(".sel");
echo(n);

I don't understand which is the problem

Hi,
it is difficult to find the cause of this problem without the rest of the code,
but there are some possibilities.

The type of the objects in questions is important - I believe, search is a string method and performs a regex search; it most likely is not available e.g. in an array.

incudes is an array method, but it might not be supported in all javascript engines, e.g. MS Explorer; I thing PSPad uses this browser for WSH scripting javascript, if it is present.
Could you possibly use indexOf in your code? (this seems more general and more widely available).

hth,
vbr

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR