DEV Community

Djilou
Djilou

Posted on

A little challenge in JavaScript (will be glad to read your solutions)

Let's do a little challenge in JavaScript
Write a function that takes two parameters
-a string
-a phrase
and returns how many times this passed string occurred in the phrase

function occurences(str,phrase){
//returns how many times str occured in phrase (number)
}

answer in the comments i'll be reading each one of them

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay