<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: HayleeRees</title>
    <description>The latest articles on DEV Community by HayleeRees (@sassy85).</description>
    <link>https://dev.to/sassy85</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1173318%2F7805dcdf-c596-4246-a4f2-78a07e6e0128.jpeg</url>
      <title>DEV Community: HayleeRees</title>
      <link>https://dev.to/sassy85</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sassy85"/>
    <language>en</language>
    <item>
      <title>From General Laborer to Coder</title>
      <dc:creator>HayleeRees</dc:creator>
      <pubDate>Mon, 27 Nov 2023 17:36:28 +0000</pubDate>
      <link>https://dev.to/sassy85/from-general-laborer-to-coder-2pg7</link>
      <guid>https://dev.to/sassy85/from-general-laborer-to-coder-2pg7</guid>
      <description>&lt;p&gt;Well here I am! Started this program on September 11, 2023 and its hard to believe that in 4 short weeks it’ll be done. I graduated high school in 2004 and just wandered for years going from job to job. I had gone to a trade school for the last 2 years of high school for Administrative Office Specialist, but could never find a job in the field. After that I got my STNA certification and started working in nursing homes. Honestly I loved working with the elderly, but the jobs expected in the amount of time given is all but impossible.&lt;/p&gt;

&lt;p&gt;Then I got pregnant and couldn’t continue my duties, and life so I moved back home. I did retail/grocery for years, which was awful on the worst days and tolerable on the best. After working in retail/grocery for years I started working at a drug rehab as a psych tech. It felt good to work there, I felt like I was helping people and maybe making a small difference in other people’s lives. Unfortunately life happened again, I was in a bad situation and had to leave the area. So I left the area with my kids and moved to a new town to start over.&lt;/p&gt;

&lt;p&gt;First job after moving was a factory job in the area making car parts. It was hot and miserable, that was just the small things. The job was originally supposed to be 3rd shift, but I was told I’d have to stay on 2nd shift. I had young children that needed their mom home in the evenings, so that didn’t last a week. After that I got a job as a chef in a nursing home, which I was absolutely no good at. Then I got a factory job that I didn’t hate, the summers were the worst because of the ovens and it not being air conditioned.&lt;/p&gt;

&lt;p&gt;I was there for almost 3 years when covid hit, and completely messed up everything. The factory I worked for printed promotional and things for gatherings. A lot of people got laid off and I was one of them unfortunately, so I stayed home for a while and waited like everyone else. Finally things started to calm down a little and I got a call back, so back to work I went. Work was so slow, most days you couldn’t get 8 hours because there just wasn’t enough work and after a few months I was laid off again. I was called back again after a couple months, but was already looking for better jobs by then.&lt;/p&gt;

&lt;p&gt;At this point in time I was no longer looking for jobs other than factory. Prices were going up, and factories usually pay the best and we were already struggling. I went to another factory with better pay, and 40 hour weeks. Life decided to smack me around again I’m sad to say. Due to family issues and the distance of that job from home I had to leave and start job hunting again. I found another job at another factory that I stayed at for a year. &lt;/p&gt;

&lt;p&gt;Except for 3 things I really did love this job. They loved to keep us over whenever a product that was due out didn’t get finished, the pay just wasn’t enough, and while I was there I had SEVERE headaches. Come to find out after I quit, the fumes from the various chemicals we worked with were the cause. After that I worked at another factory briefly, until they started implementing mandatory over time every Saturday. At this point in time in my life I am severely burnt out, I have no energy for anything outside of work and taking care of my kids. There was another family emergency, that was worst than the previous. I quit that job and moved on to another one. &lt;/p&gt;

&lt;p&gt;I found another factory job that I disliked as much as the others and trudged along. Tired, burnt out, work, home, kids, supper, sleep, and repeat. I couldn’t do it anymore, I was unhappy, struggling to make decent money just to live, tired of having no life, tired of not being able to give my kids a better life. I started looking around on the internet, poking around for jobs I could do from home. Most of those are scams…. I think 99% of them are probably scams, and I didn’t have the money most of them wanted to get started.&lt;/p&gt;

&lt;p&gt;Computers, technology, I’ve always loved working on computers, just working with new technologies in general. I was always the person everyone went to when they were having problems with their devices. I decided I wanted to build websites, apps, or help others maintain theirs. I can work from home and be wherever and still work. Now I hadn’t been on an actual computer in YEARS, but I was going to make this happen. &lt;/p&gt;

&lt;p&gt;I leaped with the help of my wonderful, supportive girlfriend. She bought me a medium grade laptop and encouraged me to get started. I started researching different coding academies and landed on this one. I started doing the prework, after getting halfway through I decided this was for me and started to apply. Unfortunately, I have not lived the best life and as such my credit is not good. Luckily, I have 2 amazing parents that have been helping me financially on this journey and also encouraged me.&lt;/p&gt;

&lt;p&gt;I started my journey into software engineering. It has not been easy, but I’ve put forth my best efforts. I’ve learned so much… HTML, CSS, JavaScript, React, Python, SLQ, Flask…….sometimes it all just bogs down my brain. I’m getting there though!! I’ve made it through Phases 1-3 thus far and am in the last week of Phase 4. So it’s a work in progress still, but in the final stages! I’m excited and anxious, wondering and worrying about what will be next. I’m ready for this new journey in my life.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Python and SQL</title>
      <dc:creator>HayleeRees</dc:creator>
      <pubDate>Mon, 06 Nov 2023 17:12:44 +0000</pubDate>
      <link>https://dev.to/sassy85/python-and-sql-1be7</link>
      <guid>https://dev.to/sassy85/python-and-sql-1be7</guid>
      <description>&lt;p&gt;These are all just my notes so far from Python and SQL.  All images are from Flatiron and are not my own work. Hope this helps someone!&lt;/p&gt;

&lt;p&gt;Python Notes&lt;br&gt;
Interpreter: a program that executes other programs. Python programs require the Python interpreter to be installed so that they can run&lt;br&gt;
Python Shell: an interactive interpreter that can be accessed from the command line&lt;br&gt;
Data Type: a specific kind of data. Python interpreter uses these types to determine which actions can be performed on different data items&lt;br&gt;
Code Block: a collection of code that is interpreted together. Python groups code blocks by indentation level&lt;br&gt;
Function: a named code block that performs a sequence of actions when it is called &lt;br&gt;
Scope: the area in your program where a specific variable can be called&lt;/p&gt;

&lt;p&gt;What Python Can Do&lt;br&gt;
    *Read and write files&lt;br&gt;
    *Listen for network requests and send responses&lt;br&gt;
    *Connect to a database to access and update data&lt;/p&gt;

&lt;p&gt;Can make all kinds of different applications-not just web applications&lt;br&gt;
    *Command line interfaces(CLIs)&lt;br&gt;
    *Web servers&lt;br&gt;
    *Games&lt;br&gt;
    *Web scrapers&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;print() is the same as console.log()&lt;/li&gt;
&lt;li&gt;# is the same as // or /* */&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To run an application python filename.py – filename.py is the &lt;br&gt;
relative path &lt;br&gt;
EXAMPLE: python lib/app.py&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Typing python in terminal will put you in a sandbox&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Exit by typing exit() or pressing ctrl + d&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;snake_case not camelCase&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;to install pytest in Pipfile enter pipenv install&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;then run pipenv shell&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;run pytest to see the tests  pytest -x to see one at a time&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Common Data Types&lt;br&gt;
Strings&lt;/p&gt;

&lt;p&gt;Python&lt;br&gt;
    dog_name = ‘Osiris’&lt;br&gt;
    print(f’Say hello to my dog(dog_name}’)&lt;br&gt;
=&amp;gt;  Say hello to my dog Osiris&lt;/p&gt;

&lt;p&gt;JavaScript&lt;br&gt;
    Const dogName = ‘Osiris’&lt;br&gt;
    Console.log(&lt;code&gt;Say hello to my dog ${dogName}&lt;/code&gt;)&lt;br&gt;
=&amp;gt;  Say hello to my dog Osiris&lt;/p&gt;

&lt;p&gt;‘hello’&lt;br&gt;
=&amp;gt;  Hello&lt;/p&gt;

&lt;p&gt;‘hello’.upper()&lt;br&gt;
=&amp;gt;  HELLO&lt;/p&gt;

&lt;p&gt;‘HELLO’.lower()&lt;br&gt;
=&amp;gt;  hello&lt;/p&gt;

&lt;p&gt;‘hello’.capitalize()&lt;br&gt;
=&amp;gt;  Hello&lt;/p&gt;

&lt;p&gt;‘hello’ + ‘world’&lt;br&gt;
=&amp;gt;  helloworld&lt;/p&gt;

&lt;p&gt;‘hello’ * 3&lt;br&gt;
=&amp;gt;  hellohellohello&lt;/p&gt;

&lt;p&gt;type(‘hello’)&lt;br&gt;
=&amp;gt;  will show you what class an object is&lt;/p&gt;

&lt;p&gt;dir(‘hello’)&lt;br&gt;
=&amp;gt;  list of all the methods that object responds to&lt;/p&gt;

&lt;p&gt;Numbers&lt;/p&gt;

&lt;p&gt;Intergers are whole numbers = 13&lt;br&gt;
Floats are decimal numbers = 4.5&lt;/p&gt;

&lt;p&gt;int(‘1’)&lt;br&gt;
=&amp;gt;  1&lt;/p&gt;

&lt;p&gt;int(1.1)&lt;br&gt;
=&amp;gt;  1&lt;/p&gt;

&lt;p&gt;float(‘1.1’)&lt;br&gt;
=&amp;gt;  1.1&lt;/p&gt;

&lt;p&gt;Will convert an interger to a float when performing math operations&lt;/p&gt;

&lt;p&gt;Sequence Types&lt;br&gt;
Lists&lt;/p&gt;

&lt;p&gt;[1, 3, 400, 7]&lt;br&gt;
=&amp;gt;  [1, 3, 400, 7]&lt;/p&gt;

&lt;p&gt;list()&lt;br&gt;
=&amp;gt;  []&lt;br&gt;
list_abc = [‘a’, ‘b’, ‘c’]&lt;br&gt;
list_abc[0]&lt;br&gt;
=&amp;gt;  a&lt;br&gt;
list_abc[1]&lt;br&gt;
=&amp;gt;  b&lt;br&gt;
list_abc[2]&lt;br&gt;
=&amp;gt;  c&lt;/p&gt;

&lt;p&gt;GIVES YOU THE NUMBER OF OBJECTS&lt;br&gt;
len([1, 3, 400, 7])&lt;br&gt;
=&amp;gt;  4&lt;br&gt;
len([2, 7, 8, 19, 39, 22, 76])&lt;br&gt;
=&amp;gt;  7&lt;/p&gt;

&lt;p&gt;SORTS FROM SMALLEST TO LARGEST&lt;br&gt;
sorted([5, 100, 234, 7, 2])&lt;br&gt;
=&amp;gt;  [2, 5, 7, 100, 234]&lt;/p&gt;

&lt;p&gt;REMOVES THE LARGEST NUMBER IN THE LIST&lt;br&gt;
list_123 = [1, 2, 3, 7, 5, 9, 6]&lt;br&gt;
list_123.pop()&lt;br&gt;
=&amp;gt;  9&lt;br&gt;
print(list_123)&lt;br&gt;
=&amp;gt;  [1, 2, 3, 7, 5, 6]&lt;/p&gt;

&lt;p&gt;REMOVES SELECTED NUMBER FROM LIST&lt;br&gt;
list_123.remove(7)&lt;br&gt;
print(list_123)&lt;br&gt;
=&amp;gt;  [1, 2, 3, 5, 6]&lt;/p&gt;

&lt;p&gt;Tuples&lt;/p&gt;

&lt;p&gt;(1, 2, 3)&lt;br&gt;
=&amp;gt;  (1, 2, 3)&lt;br&gt;
Tuple([1, 2, 3])&lt;br&gt;
=&amp;gt;  (1, 2, 3)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tuples are created with open and close parentheses&lt;/li&gt;
&lt;li&gt;tuple() can alse be used to cast lists and other iterable data types to tuples&lt;/li&gt;
&lt;li&gt;Tuples are immutable – once a tuple has been created the tuple itself CANNOT be changed&lt;/li&gt;
&lt;li&gt;Functions that work ok lists to create new data will still work on tuples – do not contain methods like .pop() and .insert() that would change their content&lt;/li&gt;
&lt;li&gt;Most commonly seen when retrieving data from a database – you want to keep an accurate record of what is in the database while your application works with the data – a tuple will protect that information until it is no longer needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sets&lt;/p&gt;

&lt;p&gt;set()&lt;br&gt;
=&amp;gt;  {}&lt;br&gt;
set([3, 2, 3, ‘a’, ‘b’, ‘a’])&lt;br&gt;
=&amp;gt;  {2, 3, ‘a’, ‘b’}&lt;/p&gt;

&lt;p&gt;Set is unindexed, unordered, and unchangeable&lt;br&gt;
=&amp;gt;  Unindexed – we can’t access elements of the set using square brackets like we do in lists and tuples&lt;br&gt;
=&amp;gt;  Unordered – the contents are in a random order&lt;br&gt;
=&amp;gt;  Unchangeable – individual elements can’t be changed&lt;/p&gt;

&lt;p&gt;Sets have many of the same methods as lists&lt;br&gt;
Can use .pop() and .remove()&lt;/p&gt;

&lt;p&gt;Dictionaries&lt;/p&gt;

&lt;p&gt;dict(x = 1, y = 2)&lt;br&gt;
=&amp;gt;  {‘x’ : 1, ‘y’ : 2}&lt;/p&gt;

&lt;p&gt;{‘key1’ : ‘value1’, ‘key2’ : ‘value2’}&lt;br&gt;
=&amp;gt;  {‘key1’ : ‘value1’, ‘key2’ : ‘value2’}&lt;/p&gt;

&lt;p&gt;my_dict = {‘key1’ : 1, ‘key2’ : 2}&lt;br&gt;
my_dict [‘key2’]&lt;br&gt;
=&amp;gt;  2&lt;/p&gt;

&lt;p&gt;Dictionaries are Python’s equivalent of a JavaScript object&lt;br&gt;
Composed of key/value pairs&lt;br&gt;
Each key points to a specific value&lt;/p&gt;

&lt;p&gt;print(my_dict[‘key3’])&lt;br&gt;
=&amp;gt;  KeyError: ‘key3’&lt;/p&gt;

&lt;p&gt;USEFUL METHOD WHEN YOU’RE UNSURE IF A KEY EXISTS – RETURNS NONE INSTEAD OF ERROR&lt;br&gt;
print(my_dict.get(‘key3’))&lt;br&gt;
=&amp;gt;  None&lt;/p&gt;

&lt;p&gt;CAN’T USE DOT NOTATION TO ACCESS KEYS ON DICTIONARIES – ONLY BRACKET NOTATION&lt;br&gt;
my_dict.key2&lt;br&gt;
=&amp;gt;  AttributeError: ‘dict’ object has no attribute ‘key2’&lt;/p&gt;

&lt;p&gt;None&lt;/p&gt;

&lt;p&gt;None – represents the absence of a value&lt;br&gt;
JavaScript has undefined and null&lt;br&gt;
Can’t create a variable without assigning a value&lt;br&gt;
Must explicitly assign a value of None in you want an empty variable&lt;/p&gt;

&lt;p&gt;no_value&lt;br&gt;
=&amp;gt;  NameError: name ‘no_value’ is not defined&lt;/p&gt;

&lt;p&gt;no_value = None&lt;br&gt;
print(no_value) &lt;br&gt;
=&amp;gt;  None&lt;/p&gt;

&lt;p&gt;Booleans&lt;/p&gt;

&lt;p&gt;Only two values true and false&lt;br&gt;
type(True)&lt;br&gt;
=&amp;gt;  &lt;br&gt;
type(false)&lt;br&gt;
=&amp;gt;  &lt;br&gt;
not True&lt;br&gt;
=&amp;gt;  False&lt;br&gt;
not False&lt;br&gt;
=&amp;gt;  True&lt;br&gt;
not 1&lt;br&gt;
=&amp;gt;  False&lt;br&gt;
not 0&lt;br&gt;
=&amp;gt;  True&lt;br&gt;
not ‘ ‘&lt;br&gt;
=&amp;gt;  True&lt;br&gt;
not None&lt;br&gt;
=&amp;gt;  True&lt;br&gt;
not [ ]&lt;br&gt;
=&amp;gt;  True&lt;br&gt;
not ( )&lt;br&gt;
=&amp;gt;  True&lt;br&gt;
not { }&lt;br&gt;
=&amp;gt;  True&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Not is the operator that reverses the truth of a value, variable, or statement&lt;/li&gt;
&lt;li&gt;Operator != asserts that 2 values are not equal&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Error Messages&lt;/p&gt;

&lt;p&gt;VS CODE&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;#!usr/bin/env python3&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;li&gt;print(hello world)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;IN TERMINAL&lt;br&gt;
python lib/a_name_error.py&lt;br&gt;
o   File ‘lib/a_name_error.py’, &lt;br&gt;
o   Line 3, in &lt;br&gt;
=&amp;gt;  Print(hello world)&lt;br&gt;
o   NameError: name ‘hello world’ is not defined&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error occurred in file ‘lib/a_name_error.py’&lt;/li&gt;
&lt;li&gt;Line of code with error line 3&lt;/li&gt;
&lt;li&gt;Scope of error &lt;/li&gt;
&lt;li&gt;Type of error NameError:&lt;/li&gt;
&lt;li&gt;Reason for error name ‘hello world’ is not defined&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Common Errors&lt;br&gt;
Syntax Errors&lt;/p&gt;

&lt;p&gt;VS CODE&lt;br&gt;
2 * &lt;br&gt;
IN TERMINAL&lt;br&gt;
=&amp;gt;  File ‘’, line 1&lt;br&gt;
o   2 * #&lt;br&gt;
o         ^&lt;br&gt;
=&amp;gt;  SyntaxError: invalid syntax&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There is a missing number – operator must be preceded  and followed my a number or variable with a numeric value&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Logic Errors&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Most difficult – not perceived as errors by Python interpreter&lt;/li&gt;
&lt;li&gt;To find will have to go through code line by line&lt;/li&gt;
&lt;li&gt;Debugging tools -pdb- helpful for locating logic errors&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;VS CODE&lt;br&gt;
    count = 1&lt;br&gt;
    while count &amp;lt; 100&lt;br&gt;
        print(‘%i’ % count)&lt;br&gt;
IN TERMINAL&lt;br&gt;
=&amp;gt;  1&lt;br&gt;
=&amp;gt;  1&lt;br&gt;
=&amp;gt;  1&lt;br&gt;
=&amp;gt;  1&lt;br&gt;
=&amp;gt;  1&lt;br&gt;
=&amp;gt;  1&lt;br&gt;
=&amp;gt;  1&lt;br&gt;
=&amp;gt;  …&lt;br&gt;
***programmer forgot to increase count during each iteration of the while loop – loop will continue forever&lt;/p&gt;

&lt;p&gt;Exceptions&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pop up when the interpreter knows what to do with a piece of code but is unable to complete the action&lt;/li&gt;
&lt;li&gt;Difference between other types of errors and exceptions – python interpreter can continue reading the application after and exception, just need to tell it what to expect&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most Common Exceptions&lt;br&gt;
Assertion Error&lt;/p&gt;

&lt;p&gt;assert(1 == 2)&lt;br&gt;
=&amp;gt;  Traceback (most recent call last):&lt;br&gt;
o   File ‘’, line 1, in &lt;br&gt;
=&amp;gt;  AssertionError&lt;/p&gt;

&lt;p&gt;IndexError and KeyError&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IndexError – when you try to access an element at an index past the end of a list&lt;/li&gt;
&lt;li&gt;KeyError – relate to dict objects – if a key is referenced but does not exist&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;list = [0, 1, 2, 3, 4]&lt;br&gt;
dict = {‘a’: 1, ‘b’: 2, ‘c’: 3}&lt;/p&gt;

&lt;p&gt;list[10]&lt;br&gt;
=&amp;gt;  Traceback (most recent call last): &lt;br&gt;
o   File ‘’, line 1 in &lt;br&gt;
=&amp;gt;  IndexError: list index out of range&lt;/p&gt;

&lt;p&gt;dict[‘d’]&lt;br&gt;
=&amp;gt;  Traceback (most recent call last):&lt;br&gt;
o   File ‘’, line 1, in &lt;br&gt;
=&amp;gt;  KeyError: ‘d’&lt;/p&gt;

&lt;p&gt;NameError&lt;/p&gt;

&lt;p&gt;flatiron_school&lt;br&gt;
=&amp;gt;  Traceback (most recent call last):&lt;br&gt;
o   File ‘’, line 1, in &lt;br&gt;
=&amp;gt;  NameError: name ‘flatiron_school’ is not defined&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Occurs when name is referenced before it’s been defined&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;TypeError&lt;/p&gt;

&lt;p&gt;wrong_type = ‘abc’ + 123&lt;br&gt;
=&amp;gt;  Traceback (most recent call last);&lt;/p&gt;

&lt;p&gt;Function Syntax&lt;br&gt;
JAVASCRIPT&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;function keyword identifies this code as a function&lt;/li&gt;
&lt;li&gt;myFunction – variable name – used to refer to function from elsewhere in our code&lt;/li&gt;
&lt;li&gt;() – where we define our parameter(s)&lt;/li&gt;
&lt;li&gt;Param – variable name given to the functions parameter – will be assigned a value when the function is invoked and passed and argument&lt;/li&gt;
&lt;li&gt;{} – define the body of the function&lt;/li&gt;
&lt;li&gt;console.log – method that will output info to the terminal – different from function’s return value&lt;/li&gt;
&lt;li&gt;return – needed when we want our function to return a value when it is called – here it will return a value of whatever the param variable is plus one&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;JAVASCRIPT&lt;br&gt;
    function myFunction(param) {&lt;br&gt;
        console.log(‘Running myFunction’)&lt;br&gt;
        return param + 1&lt;br&gt;
    const myFunctionReturnValue = myFunction(1)&lt;br&gt;
o   ‘Running myFunction’&lt;br&gt;
        console.log(myFunctionReturnValue)&lt;br&gt;
o   2&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Calling the function myFunction with an argument of 1&lt;/li&gt;
&lt;li&gt;Reassigning the return value of myFunction to a new variable – myFunctionReturnValue &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PYTHON&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;def instead of function&lt;/li&gt;
&lt;li&gt;snake_case instead of camelCase&lt;/li&gt;
&lt;li&gt;param still defined in () after method name&lt;/li&gt;
&lt;li&gt;NO {} – instead -  ():&lt;/li&gt;
&lt;li&gt;Must indent all code that is meant to be executed in function
return statements work similarly – no semicolon needed after return value&lt;/li&gt;
&lt;li&gt;NO closing – new code written at original indentation level&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PYTHON&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def my_function(param):
    print(‘Running my_function’)
    return param + 1
my_function_return_value = my_function(1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;o   Running my_function&lt;br&gt;
o   2&lt;br&gt;
        my_function_return_value&lt;br&gt;
o   2&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Calling function my_function() – see the output from print() function in terminal followed by return value&lt;/li&gt;
&lt;li&gt;Return value – 2 – is saved to variable my_function_return_value
**some functions are referred to as methods
**methods – special type of function belonging to objects – act upon those objects when called
**EXAMPLE list.sort() and dict.get()&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Arguments&lt;/p&gt;

&lt;p&gt;JAVASCRIPT&lt;br&gt;
    function sayHi(name) {&lt;br&gt;
        Console.log(&lt;code&gt;Hi there, ${name}!&lt;/code&gt;)&lt;br&gt;
    }&lt;br&gt;
    sayHi()&lt;br&gt;
o   Hi there, undefined!&lt;/p&gt;

&lt;p&gt;Bugs like these are hard to identify – only found by testing the code and looking for unexpected behavior&lt;/p&gt;

&lt;p&gt;PYTHON&lt;br&gt;
    def say_hi(name):&lt;br&gt;
    print(f’Hi there, {name}’)&lt;br&gt;
    say_hi()&lt;br&gt;
o   TypeError: say_hi() missing 1 required positional argument:&lt;br&gt;&lt;br&gt;
        ‘name’&lt;br&gt;
    say_hi() was supposed to have name as an argument&lt;/p&gt;

&lt;p&gt;Default Arguments&lt;/p&gt;

&lt;p&gt;JAVASCRIPT&lt;br&gt;
    function sayHi(name = ‘friend’) {&lt;br&gt;
        console.log(&lt;code&gt;Hi there, ${name}!&lt;/code&gt;)&lt;br&gt;
    }&lt;br&gt;
    sayHi()&lt;br&gt;
o   ‘Hi there, friend!’&lt;br&gt;
    sayHi(‘Sunny’)&lt;br&gt;
o   ‘Hi there, Sunny!’&lt;/p&gt;

&lt;p&gt;PYTHON&lt;br&gt;
    def say_hi(name=’Engineer’):&lt;br&gt;
        print(f’Hi there, {name}!’)&lt;br&gt;
    say_hi()&lt;br&gt;
o   “Hi there, Engineer!”&lt;br&gt;
    say_hi(‘Sunny’)&lt;br&gt;
o   “Hi there, Sunny!”&lt;/p&gt;

&lt;p&gt;Return Values&lt;/p&gt;

&lt;p&gt;All functions are generally useful for one or both of  these&lt;br&gt;
** What return value they have&lt;br&gt;
** What side effects the have (what other parts of the application they change; what they output to the terminal; or what they write to a file; etc)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Writing console.log() or print() is a side effect of a function – different from return value&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;JAVASCRIPT&lt;br&gt;
    function addAndLog(num1, num2) {&lt;br&gt;
        console.log(num1 + num2)&lt;br&gt;
    }&lt;br&gt;
    function addAndReturn(num1, num2) {&lt;br&gt;
        return num1 + num2&lt;br&gt;
    }&lt;br&gt;
    const sum1 = addAndLog(2, 2)&lt;br&gt;
    const sum2 = addAndReturn(2, 2)&lt;br&gt;
o   sum1 returns undefined because it is logged, not returned&lt;br&gt;
o   sum2 returns 4 because it is returned&lt;/p&gt;

&lt;p&gt;You use the return keyword to retrieve an output value just like JavaScript&lt;/p&gt;

&lt;p&gt;PYTHON&lt;br&gt;
    def style_painter():&lt;br&gt;
        best_hairstyle = ‘Bob Ross’&lt;br&gt;
        return ‘Jean-Michel Basquiat’&lt;br&gt;
        return best_hairstyle&lt;br&gt;
        print(best_hairstyle)&lt;br&gt;
    stylish_painter()&lt;br&gt;
o   ‘Jean-Michel Basquiat’&lt;/p&gt;

&lt;p&gt;return will disrupt the execution of the function and prevent Python from running any lines of code after  return keyword&lt;/p&gt;

&lt;p&gt;Pass&lt;/p&gt;

&lt;p&gt;Use pass keyword in empty functions until they are ready to be fleshed out&lt;br&gt;
    def my_future_function():&lt;br&gt;
        pass&lt;/p&gt;

&lt;p&gt;Comparison Operators&lt;/p&gt;

&lt;p&gt;JAVASCRIPT&lt;br&gt;
    ‘1’ == 1&lt;br&gt;
=&amp;gt;  True&lt;br&gt;
    0 == []&lt;br&gt;
=&amp;gt;  True&lt;br&gt;
    [] == ![]&lt;br&gt;
=&amp;gt;  True (??)&lt;/p&gt;

&lt;p&gt;PYTHON&lt;br&gt;
    ‘1’ == 1&lt;br&gt;
=&amp;gt;  False&lt;br&gt;
    1 == 1&lt;br&gt;
=&amp;gt;  True&lt;/p&gt;

&lt;p&gt;JAVASCRIPT&lt;br&gt;
    [1, 2, 3] === [1, 2, 3]&lt;br&gt;
=&amp;gt;  False&lt;br&gt;
In JS 2 arrays are unique objects in memory&lt;/p&gt;

&lt;p&gt;PYTHON&lt;br&gt;
    [1, 2, 3] == [1, 2, 3]&lt;br&gt;
=&amp;gt;  True&lt;br&gt;
    1.0 == 1&lt;br&gt;
=&amp;gt;  true&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python considers these to have equivalent values&lt;/li&gt;
&lt;li&gt;Python will check if an Integer has equivalent value to a Float&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PYTHON&lt;br&gt;
    True and true&lt;br&gt;
=&amp;gt;  true&lt;br&gt;
    False and false&lt;br&gt;
=&amp;gt;  false&lt;br&gt;
    False and true&lt;br&gt;
=&amp;gt;  False&lt;br&gt;
    True or true&lt;br&gt;
=&amp;gt;  True&lt;br&gt;
    False or false&lt;br&gt;
=&amp;gt;  False&lt;br&gt;
    False or true&lt;br&gt;
=&amp;gt;  True&lt;br&gt;
    not true&lt;br&gt;
=&amp;gt;  False&lt;br&gt;
    not not true&lt;br&gt;
=&amp;gt;  True&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ItDNZ5iH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h8xj0s06bjkdg78qmxsn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ItDNZ5iH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h8xj0s06bjkdg78qmxsn.png" alt="Image description" width="800" height="649"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;^^^Conditional statements in JavaScript VS Python&lt;/p&gt;

&lt;p&gt;Falsy Values&lt;br&gt;
Empty lists [ ]&lt;br&gt;
Empty tuples ( )&lt;br&gt;
Empty dictionaries { }&lt;br&gt;
Empty sets set()&lt;br&gt;
Empty strings ‘ ‘ or “ “&lt;br&gt;
0 or 0.0&lt;br&gt;
None&lt;br&gt;
False&lt;/p&gt;

&lt;p&gt;SQL&lt;br&gt;
In terminal:&lt;br&gt;
sqlite3  (or no file name) – opens terminal &lt;br&gt;
.quit or ctrl + d – exits terminal&lt;br&gt;
.help – list of commands&lt;br&gt;
.schema – see the structure of the database&lt;br&gt;
.headers on – output the name of each column&lt;br&gt;
.mode column – makes nice columns&lt;/p&gt;

&lt;p&gt;In VS Code:&lt;br&gt;
Right click  and click Open Database&lt;br&gt;
On bottom left of screen click the down arrow SQLITE EXPLORER&lt;br&gt;
Then click down arrow on filename&lt;br&gt;
Right click on file to select or insert&lt;/p&gt;

&lt;p&gt;In terminal to create a table&lt;br&gt;
CREATE TABLE anime (&lt;br&gt;
    id INTEGER PRIMARY KEY,&lt;br&gt;
    name TEXT, &lt;br&gt;
    number_episodes INTEGER);&lt;br&gt;
Alter Table&lt;br&gt;
ALTER TABLE anime ADD COLUMN genre TEXT;&lt;br&gt;
.schema&lt;br&gt;
CREATE TABLE anime ( &lt;br&gt;
    id INTEGER PRIMARY KEY, &lt;br&gt;
    name TEXT, &lt;br&gt;
    number_episodes INTEGER, &lt;br&gt;
    genre TEXT);&lt;br&gt;
Drop Table&lt;br&gt;
To delete a table&lt;br&gt;
DROP TABLE anime&lt;/p&gt;

&lt;p&gt;DATATYPES&lt;br&gt;
NULL – no value&lt;br&gt;
TEXT – any alphanumeric characters you want represented ad plain text&lt;br&gt;
INTEGER – whole number – no letters, special characters, or decimal points&lt;br&gt;
REAL – anything that a plain decimal (1.3 or 2.25) &lt;br&gt;
    SQL will store decimal &amp;lt;=15 characters&lt;br&gt;
BLOB – used for holding binary data&lt;/p&gt;

&lt;p&gt;Inputting information&lt;br&gt;
INSERT INTO anime (name, number_episodes, genre) VALUES (‘Dr. Stone’, 52, ‘Fantasy’);&lt;/p&gt;

&lt;p&gt;Select From&lt;br&gt;
    SELECT id, name, number_episodes, genre FROM anime;&lt;br&gt;
OR&lt;br&gt;
SELECT * FROM anime;&lt;br&gt;
SELECT name FROM anime;&lt;br&gt;
OR&lt;br&gt;
    SELECT anime.name FROM anime;&lt;br&gt;
        Gives just the names &lt;br&gt;
SELECT name, number_episodes FROM anime;&lt;br&gt;
        Gives name and number_episodes &lt;/p&gt;

&lt;p&gt;Select Where&lt;br&gt;
SELECT * FROM anime WHERE name = ‘Dr. Stone’;&lt;br&gt;
        Gives any anime with name of ‘Dr. Stone’&lt;br&gt;
SELECT * FROM anime WHERE number_episodes &amp;gt; 20;&lt;br&gt;
        Gives any anime with more than 20 episodes&lt;br&gt;
UPDATING&lt;br&gt;
UPDATE anime SET name = ‘Bleach’ WHERE name = ‘Dr. Stone’;&lt;br&gt;
        Changes the name Dr. Stone to Bleach&lt;br&gt;
DELETIING&lt;br&gt;
DELETE FROM anime WHERE id = 10;&lt;br&gt;
        Deletes the anime with the id of 10&lt;br&gt;
ORDER BY&lt;br&gt;
SELECT * FROM anime ORDER BY number_episodes; &lt;br&gt;
        Gives order smallest to largest&lt;br&gt;
SELECT * FROM anime ORDER BY number_episodes DESC;&lt;br&gt;
        Gives order largest to smallest&lt;/p&gt;

&lt;p&gt;LIMIT&lt;br&gt;
SELECT * FROM anime ORDER BY number_episodes DESC LIMIT 1;&lt;br&gt;
        Gives the first entry with the largest number of episodes&lt;br&gt;
SELECT * FROM anime ORDER BY number_episodes DESC LIMIT 2;&lt;br&gt;
        Gives first 2 entries with the largest number of episodes&lt;br&gt;
BETWEEN&lt;br&gt;
SELECT name FROM anime WHERE number_episodes BETWEEN 20 AND 50;&lt;br&gt;
        Gives all anime that have 20-50 episodes&lt;br&gt;
NULL &lt;br&gt;
INSERT INTO anime (name, number_episodes, genre) VALUES (NULL, NULL, ‘Action’);&lt;br&gt;
        Adds another anime with blank name and number_episodes&lt;br&gt;
To select&lt;br&gt;
SELECT * FROM anime WHERE name IS NULL&lt;br&gt;
COUNT&lt;br&gt;
    SELECT COUNT (owner_id) From anime WHERE owner_id = 1;&lt;br&gt;
        Shows all owners of the anime with an id of 1&lt;br&gt;
GROUP BY&lt;br&gt;
    SELECT genre, COUNT(genre) FROM anime GROUP BY genre&lt;br&gt;
        Shows all the genres of anime and how many of each&lt;br&gt;
    SELECT genre, owner_id, COUNT(genre) FROM anime GROUP BY genre, owner_id;&lt;br&gt;
        Breaks down above by showing more than 1 owner of a genre&lt;/p&gt;

</description>
      <category>python</category>
      <category>sql</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Hooks</title>
      <dc:creator>HayleeRees</dc:creator>
      <pubDate>Sun, 22 Oct 2023 21:36:42 +0000</pubDate>
      <link>https://dev.to/sassy85/hooks-717</link>
      <guid>https://dev.to/sassy85/hooks-717</guid>
      <description>&lt;p&gt;Hooks, the bane of my existence. What are they? What do they do? How do you use them? I hope to answer all these questions here. First of all a hook is a function that lets you ‘hook into’ different react features. Think of it as an array with two different values. The first value would be a variable with the state. The second value is a variable with a handler-a function will change the current state. Something that didn’t dawn on me till writing this: values are functions, and functions are values. Here’s an example of what I mean below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Pj80qWMc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/473q6po5ghzm6wfa42gd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Pj80qWMc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/473q6po5ghzm6wfa42gd.png" alt="Image description" width="170" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me explain what’s going on. &lt;br&gt;
 You are assigning the number 10 to the variable c. So when you console.log(c) it gives you the assigned number: 10.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6wxxoEj5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h9lg9jfs1bdk3i5hw0ge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6wxxoEj5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h9lg9jfs1bdk3i5hw0ge.png" alt="Image description" width="186" height="81"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; In this case you are assigning the answer to the equation to the variable o, NOT THE EQUATION ITSELF. So when you console.log(o) you get 69.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X7XJ9BZB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qf4pmx4p9lagrc7gw03a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X7XJ9BZB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qf4pmx4p9lagrc7gw03a.png" alt="Image description" width="451" height="85"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; Here we are actually assigning an entire function to our variable. So this time when you console.log(d) it shows you that function and what it does.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ipV4pwwh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cznph3f59cwi8um3bguw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ipV4pwwh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cznph3f59cwi8um3bguw.png" alt="Image description" width="194" height="96"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; Now finally in our last one we are assigning d() to the variable e. This time when you&lt;br&gt;
 console.log(e) it gives you the string you assigned to the function assigned to d.&lt;br&gt;
    With useState you can add React state to functional components, but only ones declared as a function. The hook has state kept inside it, but is accessible from the component where  you called the hook. Some Simple rules to follows: always use hooks at the top level of the React component. Don’t call them inside loops, conditions, or nested functions. Hooks must be called in the same order every time a component renders. That’s how React preserves the state of the hooks between many different useState and useEffect calls. You can not call hooks on regular JavaScript functions, only on React components and custom hooks.&lt;br&gt;
    To use useState first you must import it from the the React library, then you have to invoke it inside the react component. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mZ5ppG01--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tmjtdnab768hsbdxipg3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mZ5ppG01--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tmjtdnab768hsbdxipg3.png" alt="Image description" width="629" height="113"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WG5gvm69--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rlqblwfgwm5604ogl4dh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WG5gvm69--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rlqblwfgwm5604ogl4dh.png" alt="Image description" width="663" height="100"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you can call the set to update the state value or render state freely. Here’s an example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EHmOsZdF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6oycfie3809drba9j0wm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EHmOsZdF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6oycfie3809drba9j0wm.png" alt="Image description" width="577" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here’s what is looks like in browser:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jOGTDrmU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dx2qwmyrsq5ph7b754et.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jOGTDrmU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dx2qwmyrsq5ph7b754et.png" alt="Image description" width="255" height="126"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If your variable comes from other data you don’t need state. For instance if you’re changing the theme color from dark to light based on the time of day, that can come from the system data.  A toggle is true or false and is triggered when a button is clicked, we don’t need state here either. When we want to store the input from the user or when an event is triggered, that’s when we use state. Form data is also stored in state at least until it’s sent to the database, where it can be retrieved and edited again.&lt;br&gt;
    This would be the best first approach to handling multiple states at once:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9EpotYmK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zsyo4q5exxvwc3zkli9p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9EpotYmK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zsyo4q5exxvwc3zkli9p.png" alt="Image description" width="635" height="867"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In browser:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yytSayuQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h8u8dqlbz9yjxgd1yft9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yytSayuQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h8u8dqlbz9yjxgd1yft9.png" alt="Image description" width="266" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another way to do this, but is a bit messy is:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y-pBhy_Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ey2i2yncknxhyq6ayht5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y-pBhy_Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ey2i2yncknxhyq6ayht5.png" alt="Image description" width="694" height="817"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OGC8ADju--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tgtx7g8z08i5u02wecq2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OGC8ADju--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tgtx7g8z08i5u02wecq2.png" alt="Image description" width="261" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is more complex because we need to spread the existing object and then add the change or you’ll lose it.&lt;/p&gt;

&lt;p&gt;Changing state is asynchronous and here’s an example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--um_HEXA2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3h9jw07rad6fzvt7mekp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--um_HEXA2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3h9jw07rad6fzvt7mekp.png" alt="Image description" width="662" height="844"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WfYCkvP_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hj7qhfkuwz8btuxuowrj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WfYCkvP_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hj7qhfkuwz8btuxuowrj.png" alt="Image description" width="456" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example I created a function handleOgresCount and I called setOgres with the new value. Doing this made it so the state wasn't updated immediately. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Differences Between textContents, innerText, and innerHTML and When to Use What.</title>
      <dc:creator>HayleeRees</dc:creator>
      <pubDate>Mon, 16 Oct 2023 02:44:49 +0000</pubDate>
      <link>https://dev.to/sassy85/differences-between-textcontents-innertext-and-innerhtml-and-when-to-use-what-2h64</link>
      <guid>https://dev.to/sassy85/differences-between-textcontents-innertext-and-innerhtml-and-when-to-use-what-2h64</guid>
      <description>&lt;p&gt;You would think textContents, innerText, and innerHTML would work the same way in JavaScript. There are so many ways to accomplish the same thing while coding, that this is just another. You would be wrong, all three of these render different output when using them. &lt;/p&gt;

&lt;p&gt;Here’s an example of some simple HTML with some inline CSS:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--potzi1f7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/seaaa7v913mora4vigit.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--potzi1f7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/seaaa7v913mora4vigit.png" alt="Image description" width="597" height="189"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is what that looks like opened up in the browser:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x0sEy02R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4h8kp3zy8nc2d5dljfsc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x0sEy02R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4h8kp3zy8nc2d5dljfsc.png" alt="Image description" width="800" height="75"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see the word ‘emphasized’ is in italics and the word ‘code’ monospaced. For those wondering monospaced means all or most the characters take up the same amount of horizontal space. In a console we set a const to our div and call that const with ‘.innerHTML’:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rN5izs7Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9j7ek4u2l9322l1h0lci.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rN5izs7Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9j7ek4u2l9322l1h0lci.png" alt="Image description" width="800" height="126"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using innerHTML shows you everything in the HTML markup contained in a string. This includes elements like spacing, line breaks and formatting. As you can see in the example above we see the &lt;em&gt;&lt;/em&gt; tags around the word emphasized making the word italic, we are also shown the 6 spaces between ‘emphasized’ and ‘and’, and lastly we see the &lt;code&gt;&lt;/code&gt; tags. You should only use innerHTML when you want to see the HTML markup and what is in the element.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dq7eEKJb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/moxs4idt0ukmibkg136b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dq7eEKJb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/moxs4idt0ukmibkg136b.png" alt="Image description" width="508" height="141"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using innerText returns the string inside the div, it renders the text content of a node and knows about the styling and CSS. In the example above we again set the div to a const and then call it with ‘.innerText’. The return is exactly the same as it appears in the browser. You do not see the spacing oddity or the &lt;em&gt; and &lt;code&gt; tags. Use innerText when you only want to see the element.&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KrXGNj69--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2jbvv85psrwj4r3xu3xd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KrXGNj69--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2jbvv85psrwj4r3xu3xd.png" alt="Image description" width="610" height="124"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;TextContent returns content of all elements in the node. Its aware if script and style elements, also formatting like spacing and line breaks. In the example above we set the div to a const and call on it with ‘.textContent’. The return is almost as it appears in the browser with the exception of the spacing. You should use textContent when you want to see what in an element plus any styling.&lt;/p&gt;

&lt;p&gt;Some additional notes, in innerHTML if the text inside the element includes ‘&amp;amp;’, ‘&amp;lt;’, or ‘&amp;gt;’ they will be returned as HTML entities ‘&amp;amp;amp’, ‘&amp;amp;lt’ and ‘&amp;amp;gt’. Using innerText sets the content of the tag as plain text, in innerHTML it retrieves and sets the content in HTML format. The difference between innerText and textContent is that innerText is aware of it’s appearance and textContent is not.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>My First Webpage</title>
      <dc:creator>HayleeRees</dc:creator>
      <pubDate>Sun, 01 Oct 2023 19:56:04 +0000</pubDate>
      <link>https://dev.to/sassy85/my-first-webpage-2j65</link>
      <guid>https://dev.to/sassy85/my-first-webpage-2j65</guid>
      <description>&lt;p&gt;Finally passed the code challenge in phase 1 at Flatiron School. While studying for the challenge I also had to complete a group project and present it the day after. I worked with two great guys, and together we created a website with a list of our favorite bands. Getting started was probably the hardest part, it was difficult to know where to start. Should we make our own API, get one off a website? Then where do we go from there?&lt;br&gt;
First, and I can not stress this enough, READ THE README!!! I didn’t even know there was a place to go to get premade lists that you could use to build the site. So, we made our own just a short list of five of our favorites with an image, an audio clip, and a brief description and their top three hits. Searching for images to save to the file was easy, just saved the picture to my laptop and moved it over to an assets folder. The description told the reader what genre the band was, a list of the band members, and their top three hits they had. &lt;br&gt;
While working on this another group member was getting the GitHub set up with the basic files necessary index.html, index.js, style.css, and an assets folder for the images and audio clips. After doing all this he added myself and the other group member as collaborators for the project. He created several branches to work on different sections of the website. A HTML branch, CSS branch, Index branch, and the main branch of course. Get familiar with GitHub!! It holds a wealth of knowledge, and a lot of other neat projects other people have worked on.&lt;br&gt;
Next up was the bones of the web page. At the top of every HTML page you have &amp;lt;!DOCTYPE html&amp;gt; and . I assume that the “en” is different if you’re building in another language. Then you have the header and all the different information stored there. The meta tag and the title describing the site. Then we had items attached to the header telling the server where the information was coming from. The script giving the webpage form and depth; the link to jazz it up and look nice with different colors, fonts and styles; and the audio to connect the clips of the different artists.&lt;br&gt;
After the header we just had to give it a very basic body. At the top of body we have a div with an h1 for the title of the webpage. This is the actual visible title you can see, not like the one in the header. After that we placed several different divs with different tags. The different tags and IDs make it easier to place the different objects on the site.  We created a place for our images with spots for the name of the band above the picture and the description below. &lt;br&gt;
Then at the bottom of the body we created a form tag. This is different from the divs because we want to be able to give the readers a change to add there own bands and descriptions. So with this form tag we created a spot for the user to enter their own favorite band with and image url and description.  After that we closed the form tag and closed out the body and html tags. We had the bones for our website, now time to start fleshing it out. Back to the API we were creating which was giving myself and the another member problems.&lt;br&gt;
SO…. Audio clips are a pain to find. Just 30 second clips of at least popular song from each band we had picked. We found this part very difficult. Searched several different websites, downloaded several ringtone apps all to no avail. I found plenty of site that had sound bites of animal sounds, nature sounds, car engines, machine guns. We just needed short clips of songs, not even the whole thing!&lt;br&gt;
So we ended up having to get a little creative. So instead of finding and downloading the clips we made our own!! We went to a music playing site and recorded the sound with our phones! Primitive I know, but it actually worked out rather well. We recorded a short 30 second clip singing the chorus of the song, then uploaded it the laptop. After the clip was on the laptop it was just a matter of making sure it was trimmed to correct time length and moving it over to the assets folder. &lt;br&gt;
Well we have our database set with the names, images, audio clips, and descriptions. The HTML is all set for us to grab and insert the information were we want it. First you have to do a fetch(). Doing this connects your database to the JS so the system knows what information to insert. Then you have to get the response in json. The line under the fetch should look something like this &lt;br&gt;
 .then((resp) =&amp;gt; resp.json()) .&lt;br&gt;
 This is a promise that the server will give you when its done running. &lt;br&gt;
After that we take our array of data and separate it into objects. An example would be &lt;br&gt;
.then(data =&amp;gt; {&lt;br&gt;
data.forEach (band =&amp;gt; {.&lt;br&gt;
The forEach expression will place the data we’re pushing to the HTML and repeat the process for each object, in this case our bands. Then we start creating different elements for each item in the band. A h2 element that shows above the picture of the band. Then you set the innerText to the band.name . &lt;br&gt;
For the image tag you set the source. In this case the source was our assets folder. So we copied the relative path to the images and set them to the source. For whatever reason if the images wouldn’t show the name of the band would appear by setting the alt for the image to the band name. The we created a h3 element to house the text for the descriptions of our bands. Then it was just a matter of setting the innerText to that on the database. &lt;br&gt;
Three EventListners were necessary to pass the project, we picked a like button, a submission form, and a mouse hover. You could click the like button an it would show the band’s likes going up. When a user would move their mouse over the page, when it hovered over an image of a band a sound clip would play. Then finally the submission form at the bottom of the page, there a user could add their favorite band to the page. Create EventListners can be fun and a little tricky sometimes, googling for help is a must!! &lt;br&gt;
For the like button first you have to create the button using “const”, then use “let” to let the numberOfLikes to zero. Then you set the innerText for the likeButton by setting equal to the numberOfLikes with the string of “ Likes”. Make sure you put a space before the word “Likes” or the number of likes will be connected to the word “Likes”. Then you have to create the listener for the click. This will make it so that each time the button is clicked the number will to up. To do this you make the innerText set to ++numberOfLikes.&lt;br&gt;
Next to set the sound for the mouse hover. To do this you have to listen for the mouse to enter and exit the image field. When the mouse enters the image field the clip starts and when the mouse leaves it stops. Make a “const” for the audio clip and like an image set the source to the clip in the assets folder. Also like an image we set the alt to the band name and song so if it doesn’t play we still know what it is. After creating the const you attach the EventListeners for mouseenter and mouseleave. &lt;br&gt;
For both of the EventListners thus far we have used “click” as the listener, but forms are a little different. For forms the EventListner is listening for a submit rather than a click. First we create the form by setting it to a “const”. Then we tell it was the form will contain, spots for the new band name, image and a description of the band. Then render it to the HTML the same way the bands we already put on the page are. &lt;br&gt;
There it is!! It’s not pretty, but all the elements necessary to pass the project are there. So our group stopped there. We all had the code challenge to study for, and if we didn’t pass that we didn’t move on to the next phase. I’m happy to say that all members of my group project passed our challenge and made it to phase 2, which was a great relief. After passing we all decided to play around with our code, I decided to create some CSS and make it prettier. &lt;br&gt;
First I decided a picture of the red carpet would be neater than just a plain colored background. So I found a picture that I liked and put it in the assets folder. I then selected the body of the html and set the image for the background to the image I had just found. Then I just had to make sure it was centered and fit the entire page from corner to corner. It wanted to place the picture in a repeating pattern, but I didn’t like how it looked so just made it stretch to fit. Picture was a little more grainy than I would have liked, but not bad. &lt;br&gt;
The images were all different sizes which made it look clunky. I grabbed the images and set the display to block, the max-width to 1000px, auto set the height and margin. Now the images where all the same dimensions, which cleaned them up nicely. Then I center aligned them and add a white double border just to make them pop a little. Now the pictures look good, but the band titles and descriptions are still plain, dull and messy.&lt;br&gt;
So then I set about center aligning the band name and description, changed the font family, the color the size of the font. Playing with colors was fun, they don’t give you very many options though. I actually found this great website  &lt;a href="https://htmlcolorcodes.com/color-picker/"&gt;https://htmlcolorcodes.com/color-picker/&lt;/a&gt;  that gives you the hex number for the shade you pick. So you can sit there and move the cursors around until you find the perfect color. When you finally get to the color you like just copy and paste the hex number and you’ll have the exact color you want. I’m very particular about my colors, I always want just the right shade.&lt;br&gt;
I would have liked to get into the font families more, but was running out of time. I found several that I liked, but couldn’t figure out the correct set of commands to get them set in the code. It’s something I will have to play around with if I hope to get better at it. I love the old English and cursive fonts I just find them so pretty, if not a little hard to read. After finishing the project I found out we could of used an already put together API. I think we could of done more if we would have read everything before just jumping right in. &lt;br&gt;
I think that is probably my biggest take away. Read everything thoroughly before you get started on any project. It is one the things that has caused me the most problems on this journey to better myself. Read everything through before just jumping right in, most of the time you are just making it harder on yourself. Information that would have made your life easier. My other advise would me to check your spelling and camelcasing. The number of times I stared at my screen because something wasn’t working right, and all it turned out to be was I didn’t capitalize the T in innerText!! Happy Coding People!! Good Luck!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
