JavaScript JavaScript Basics Storing and Tracking Information with Variables Using String Methods

Munyaradzi Matewe
Munyaradzi Matewe
1,673 Points

Use the JavaScript .toUpperCase( ) string method to assign an all uppercase version of the id variable to the userName v

var id = "23188xtr";
var lastName = "Smith";
var res=str.toUpperCase();

var userName= id;
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="app.js"></script>
Steven Parker
Steven Parker
163,747 Points

In future, please post questions only once (this one was duplicated 18 times!).

1 Answer

Tanyaradzwa Gozhora
Tanyaradzwa Gozhora
6,639 Points

Instead of naming the variable you wanted to change, you had named the function you're using that is you were meant to say:

var userName = id.toUpperCase();

so that a Upper case version of id is assigned to username.

Right now saying str.toUpperCase(); makes the computer look for a variable named "str". You had to substitute the variable name. Hope this helps, mufesi wangu.