/    Sign up×
Community /Pin to ProfileBookmark

How do i count this string method?

i can not seem to understand how do i count this form backward given the start value?
do i count from the number specified to the begining?
or do i count from the end till the starting point?

`var str = “Hello planet earth, you are a great planet.”;
var n = str.lastIndexOf(“planet”, 20);
document.getElementById(“demo”).innerHTML = n;`

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERDec 22.2020 — Do you mean display rather than count? count = str.length;

Or from start or end position: count =str.length - 20;
Copy linkTweet thisAlerts:
@FakialedDec 23.2020 — Don't have time to do your homework on your own? I write my paper for me free on this online service. Then you can type [cheap writing paper](https://payforessay.net/) without any effort. They will do everything for you while you can rest.
Copy linkTweet thisAlerts:
@Code_hunterauthorDec 27.2020 — @JMRKER#1626113 Hi, i meant count.i got this now. Thank you for ur time. :D
Copy linkTweet thisAlerts:
@JMRKERJan 17.2021 — @Code_hunter#1626199 I don't see the variable 'i' or 'count.i' anywhere in your original code.

Difficult to guess the correct solution when information for the problem is incomplete.

Glad you solved your problem. 😆
Copy linkTweet thisAlerts:
@JennieMillerJan 25.2021 — i am happy to see that you resolve this problem.
Copy linkTweet thisAlerts:
@VITSUSAJan 25.2021 — @JennieMiller#1627135 We are here to help everybody. You got solution, that's great.
×

Success!

Help @Code_hunter spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 3.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,

tipper: Anonymous,
tipped: article
amount: 10 SATS,
)...