Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 81
  • Last Modified:

Dividing an input string into two strings.. JAVASCRIPT

This is a homework question that I couldn't solve, the coding I wrote keeps giving me an error.
Using the Scanner, input a string that contains a single exclamation mark.
Divide the input string into two strings, one before and the other after the
exclamation mark, and output them. Do not include the exclamation mark in
the output. For example, if the input string is one potato two potato !three,
then the output would be
one potato two potato
three
0
ahmet buyuknahirci
Asked:
ahmet buyuknahirci
  • 2
1 Solution
 
Julian HansenCommented:
Lookup the JavaScript function split().
0
 
Julian HansenCommented:
var str = "one potato two potato !three";
var newstr = str.split('!');
console.log(newstr);

Open in new window

0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now