JavaScript Remove character and special symbol and Convert String to array in javascript remove character special javascript,remove character special php,remove character

I have a string like "D-30-25-4", then I want 30 and 25 as the desired result

I have tried this

value = "D-30-25-4";
value1= parseInt(value.substring(5,7)); // 25
value12 = parseInt(value.substring(2,4)); //30

but it fails when value is "D-30-100-4";

Answer:1

You could split and slice the string for item at index 1 and 2.

function parts(s) {
    return s.split('-').slice(1, 3);
}

var object = { 2: "D-30-25-4", 3: "D-30-50-4", 4: "D-30-10-4", 15: "D-30-100-4" };
    
console.log(parts(object[2]));
console.log(parts(object[15]));
Answer:2

try this:

let [,value1,value12] = value.split('-').map(parseFloat)
Answer:3

This ain't something not working but just I'm confusing about how to do it, I want to fetch the values from my DB based on users' preferences that been chosen earlier. These are the steps will be ...

This ain't something not working but just I'm confusing about how to do it, I want to fetch the values from my DB based on users' preferences that been chosen earlier. These are the steps will be ...

  1. post html select value
  2. html post select
  3. html post select option value
  4. html post select multiple
  5. html post select value and text
  6. html post select option
  7. post select html php
  8. html post select multiple values
  9. html post disabled select
  10. html post on select change
  11. html post all select options
  12. html select post form
  13. html select post data
  14. html post form on select change
  15. html select post django
  16. html select post name

I'm working on a VOIP application using node js and webrtc. I'm having a problem with microphone being denied on start by chrome when I change IP from localhost to 192.168..... When I start my ...

I'm working on a VOIP application using node js and webrtc. I'm having a problem with microphone being denied on start by chrome when I change IP from localhost to 192.168..... When I start my ...

  1. chrome microphone permissions
  2. chrome microphone permission error
  3. chrome extension microphone permission
  4. google chrome microphone permission
  5. ios chrome microphone permission
  6. chrome add microphone permission
  7. chrome not asking for microphone permission

I made a Morris.js graph: http://thuis.xitro.nl/ I do not want to set a value in ymin, I have this on "auto". I now have very long numbers because of that, example: 55.29999999999999 I want that to ...

I made a Morris.js graph: http://thuis.xitro.nl/ I do not want to set a value in ymin, I have this on "auto". I now have very long numbers because of that, example: 55.29999999999999 I want that to ...

I am working on a code to get a JSON value from javascript to my JSP. The JSON value is a boolean, so I could use if/else in my JSP script. I have two javascript files and a JSP. Widget.js ...

I am working on a code to get a JSON value from javascript to my JSP. The JSON value is a boolean, so I could use if/else in my JSP script. I have two javascript files and a JSP. Widget.js ...

  1. pass json value in javascript
  2. pass json value as string
  3. pass json value in url
  4. pass json value in c#
  5. pass json value
  6. json pass value to controller
  7. how to pass json value in postman
  8. json pass null value
  9. how to pass json value in ajax
  10. json pass boolean value
  11. how to pass json value in php
  12. how to pass json value in java
  13. how to pass json value in angular
  14. pass date value json