Q:

Write a JavaScript program to remove a character at the specified position of a given string and return the new string

0

 Write a JavaScript program to remove a character at the specified position of a given string and return the new string

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

function remove_character(str, char_pos) 
 {
  part1 = str.substring(0, char_pos);
  part2 = str.substring(char_pos + 1, str.length);
  return (part1 + part2);
 }

console.log(remove_character("Python",0));
console.log(remove_character("Python",3));
console.log(remove_character("Python",5));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now