Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8728411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:38:04+00:00 2026-06-13T08:38:04+00:00

In Javascript, I am trying to take a full name (First, Middle, and Last)

  • 0

In Javascript, I am trying to take a full name (First, Middle, and Last) that is typed into a field and once the submit button is clicked to outputs to three separate fields Character Length, Middle Name, and the 3 initials. I have got to the character field so far but I am stumped on how to take the information that is between two spaces.

// strings.js
// This script takes a name and spits out its character length with initials.

// Function called when the form is submitted.
// Function performs the calculation and returns false.
function formatNames() {
'use strict';

// For storing the Full Name, Middle name, initials, length:
var lengthName;
var middleName;
var yourInitials;


// Get a reference to the form values:
var fullName = document.getElementById('fullName').value;

// Perform the character spit out:
lengthName = fullName.length;

// Pull out the middle name:

// Display the volume:
document.getElementById('nameLength').value = lengthName;

// Return false to prevent submission:
return false;

} // End of formatNames() function.

// Function called when the window has been loaded.
// Function needs to add an event listener to the form.
function init() {
'use strict';
document.getElementById('theForm').onsubmit = formatNames;
} // End of init() function.
window.onload = init;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:38:05+00:00Added an answer on June 13, 2026 at 8:38 am

    This sounds homework-ish so I’ll give you some tips without spoiling the learning experience.

    You can use split(' ') on a string to get an array of words (seperated by spaces) in that string.

    You can use charAt(0) on a string to get the first letter of a string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a Javascript function that will take a mathematical expression and
I am trying to write some javascript that will automatically take text in a
Take the following piece of javascript that is trying to implement a class: function
I am trying to write a simple decrypt function in JavaScript that would take
I'm trying to create a javascript function that can take a fraction input string
I am trying to fire a javascript by onclick event of submit button but
I am trying to learn JavaScript... I have function like, I take the format
I'm a JavaScript novice trying to build a basic share button as a learning
Using JavaScript I'm trying to split a paragraph into it's sentences using regular expressions.
I am trying inherit objects in JavaScript. Take a look at this example: var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.