Skip to content

Commit

Permalink
made the object into a class
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyiho committed Oct 2, 2023
1 parent a7442ea commit 527d296
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions _notebooks/2023-08-30-basics-js-data-types.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 13,
"metadata": {
"vscode": {
"languageId": "javascript"
Expand Down Expand Up @@ -139,7 +139,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 14,
"metadata": {
"vscode": {
"languageId": "javascript"
Expand Down Expand Up @@ -248,7 +248,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 15,
"metadata": {
"vscode": {
"languageId": "javascript"
Expand Down Expand Up @@ -285,8 +285,7 @@
"console.log(\"Array: removing from end of list\")\n",
"arr_data.pop()\n",
"console.log(arr_data)\n",
"</script>\n",
"\n"
"</script>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
Expand Down Expand Up @@ -341,7 +340,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 16,
"metadata": {
"vscode": {
"languageId": "javascript"
Expand Down Expand Up @@ -454,7 +453,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 23,
"metadata": {
"vscode": {
"languageId": "html"
Expand All @@ -469,19 +468,20 @@
"<script>\n",
"// Create an object representing Trystan Schmits\n",
"function doStuff(){\n",
"var person = {\n",
" name: \"Trystan Schmits\",\n",
" age: 16,\n",
" currentClasses: [\"AP Calc\", \"Us History\", \"American Lit\", \"CSSE\", \"Physics\"],\n",
" interests: [\"Soccer\", \"Coding\", \"games\"],\n",
" favoriteBooks: [\"Harry Potter\", \"The Lion, the Witch, and The Wardrobe\"],\n",
"class perso{\n",
" name= \"Trystan Schmits\";\n",
" age= 16;\n",
" currentClasses= [\"AP Calc\", \"Us History\", \"American Lit\", \"CSSE\", \"Physics\"];\n",
" interests= [\"Soccer\", \"Coding\", \"games\"];\n",
" favoriteBooks= [\"Harry Potter\", \"The Lion, the Witch, and The Wardrobe\"];\n",
"};\n",
" \n",
"// Print the entire object\n",
"console.log(\"Original Object:\");\n",
"console.log(person);\n",
"console.log(perso);\n",
"\n",
"setTimeout(100);\n",
"var person = new perso;\n",
"// Manipulate the arrays within the object\n",
"person.currentClasses.push(\"Spanish 7\");\n",
"person.interests.splice(2, 1,\"History 3\");\n",
Expand All @@ -506,7 +506,7 @@
"var typeOfInterests = typeof person.interests;\n",
"var typeOfAge = typeof person.age;\n",
"\n",
"// Print the types of fields\n",
"// Print the types of fields ojojo\n",
"console.log(\"\\nTypes of Fields:\");\n",
"console.log(\"Type of 'name':\", typeOfName);\n",
"console.log(\"Type of 'interests':\", typeOfInterests);\n",
Expand All @@ -529,19 +529,20 @@
"<script>\n",
"// Create an object representing Trystan Schmits\n",
"function doStuff(){\n",
"var person = {\n",
" name: \"Trystan Schmits\",\n",
" age: 16,\n",
" currentClasses: [\"AP Calc\", \"Us History\", \"American Lit\", \"CSSE\", \"Physics\"],\n",
" interests: [\"Soccer\", \"Coding\", \"games\"],\n",
" favoriteBooks: [\"Harry Potter\", \"The Lion, the Witch, and The Wardrobe\"],\n",
"class perso{\n",
" name= \"Trystan Schmits\";\n",
" age= 16;\n",
" currentClasses= [\"AP Calc\", \"Us History\", \"American Lit\", \"CSSE\", \"Physics\"];\n",
" interests= [\"Soccer\", \"Coding\", \"games\"];\n",
" favoriteBooks= [\"Harry Potter\", \"The Lion, the Witch, and The Wardrobe\"];\n",
"};\n",
" \n",
"// Print the entire object\n",
"console.log(\"Original Object:\");\n",
"console.log(person);\n",
"console.log(perso);\n",
"\n",
"setTimeout(100);\n",
"var person = new perso;\n",
"// Manipulate the arrays within the object\n",
"person.currentClasses.push(\"Spanish 7\");\n",
"person.interests.splice(2, 1,\"History 3\");\n",
Expand Down

0 comments on commit 527d296

Please sign in to comment.