JS midterm study

This commit is contained in:
2025-10-21 21:38:06 -04:00
parent 3f1f4de7bf
commit 919a33b5a3
2 changed files with 86 additions and 0 deletions

View File

@@ -132,6 +132,41 @@
</ul>
<hr>
<h2>JavaScript Global Functions</h2>
<ol>
<li>Describe the operation and the return for the following global functions:</li>
<ul>
<li>parseInt(number)</li>
<li>parseFloat(number)</li>
</ul>
</ol>
<p>Answers:</p>
<ul>
<li>parseInt(number) takes a string as input and returns the first integer in the string. Can also accept a
radix option</li>
<li>parseFloat(number) takes a string as input and returns the first float value in the string.</li>
</ul>
<hr>
<h2>JavaScript String Methods</h2>
<ol>
<li>Describe the operation and the return for the following String methods.</li>
<ul>
<li>length</li>
<li>toLowerCase()</li>
<li>toUpperCase()</li>
<li>charAt()</li>
</ul>
</ol>
<p>Answers:</p>
<ul>
<li>length gets the character count of a string including spaces</li>
<li>toLowerCase() turns all uppercase letters to lowercase letters</li>
<li>toUpperCase() turns all lowercase letters to uppercase letters</li>
<li>chatAt() takes a number for the index of the word to search through and returns the character at that index.
</li>
</ul>
<h2>Playground</h2>
<p>Interactive JavaScript follows</p>