S
S
Shukhrat Rustamov2020-06-21 21:27:11
JavaScript
Shukhrat Rustamov, 2020-06-21 21:27:11

How can I remove a fragment of a line up to a point in js?

How can I remove the entire fragment of the string up to the point. For example, there is a string 'someimage.jpg', how to remove 'someimage'?

Or if someone uses multer, how to put the name of the uploaded file yourself and add just the file extension there?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny, 2020-06-21
@shukha04

1. Nus, you can use it path.extname(after including it in the executable file).
2. You can split the string by point split('.'), and use the last element of the array.
3. Just receive regularly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question