<?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: Prajwal k</title>
    <description>The latest articles on DEV Community by Prajwal k (@prajwal056).</description>
    <link>https://dev.to/prajwal056</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%2F873851%2F360d6cb2-c865-46d0-84ca-3de88884584f.png</url>
      <title>DEV Community: Prajwal k</title>
      <link>https://dev.to/prajwal056</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prajwal056"/>
    <language>en</language>
    <item>
      <title>Linux and Bash Command Cheat Sheet: The Basics</title>
      <dc:creator>Prajwal k</dc:creator>
      <pubDate>Sun, 26 Jun 2022 16:45:18 +0000</pubDate>
      <link>https://dev.to/prajwal056/linux-and-bash-command-cheat-sheet-the-basics-1a1c</link>
      <guid>https://dev.to/prajwal056/linux-and-bash-command-cheat-sheet-the-basics-1a1c</guid>
      <description>&lt;h1&gt;
  
  
  Getting information
&lt;/h1&gt;

&lt;p&gt;Return your user name&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;whoami
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Return your user and group id&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;id
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Return operating system name, username, and other info&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;uname -a
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Display reference manual for a command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;man top
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Get help on a command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --help
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Return the current date and time&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;date
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Monitoring performance and status
&lt;/h1&gt;

&lt;p&gt;List selection of or all running processes and their PIDs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ps
ps -e
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Display resource usage&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;top
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List mounted file systems and usage&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Working with files
&lt;/h1&gt;

&lt;p&gt;Copy a file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp file.txt new_path/new_name.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change file name or path&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mv this_file.txt that_path/that_file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove a file verbosely&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rm this_old_file.txt -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create an empty file, or update existing file's timestamp&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch a_new_file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change/modify file permissions to 'execute' for all users&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x my_script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Get count of lines, words, or characters in file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wc -l table_of_data.csv
wc -w my_essay.txt
wc -m some_document.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Return lines matching a pattern from files matching a filename pattern - case insensitive and whole words only&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grep -iw hello \*.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Return file names with lines matching the pattern 'hello' from files matching a filename pattern&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grep -l hello \*.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Navigating and working with directories
&lt;/h1&gt;

&lt;p&gt;List files and directories by date, newest last&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -lrt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find files in directory tree with suffix 'sh'&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;find -name '\*.sh'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Return present working directory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pwd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make a new directory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir new_folder
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change the current directory: up one level, home, or some other path&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ../
cd ~ or cd
cd another_directory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;remove directory, verbosely&lt;/p&gt;

&lt;h1&gt;
  
  
  Printing file and string contents
&lt;/h1&gt;

&lt;p&gt;Print file contents&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat my_shell_script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Print file contents page-by-page&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;more ReadMe.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Print first N lines of file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;head -10 data_table.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Print last N lines of file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tail -10 data_table.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Print string or variable value&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "I am not a robot"
echo "I am $USERNAME"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Compression and archiving
&lt;/h1&gt;

&lt;p&gt;Archive a set of files&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tar -cvf my_archive.tar.gz file1 file2 file3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compress a set of files&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;zip my_zipped_files.zip file1 file2
zip my_zipped_folders.zip directory1 directory2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Extract files from a compressed zip archive&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;unzip my_zipped_file.zip
unzip my_zipped_file.zip -d extract_to_this_direcory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Performing network operations
&lt;/h1&gt;

&lt;p&gt;Print hostname&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hostname
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Send packets to URL and print response&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ping www.google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Display or configure system network interfaces&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ifconfig
ip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Display contents of file at a URL&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl &amp;lt;url&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Download file from a URL&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wget &amp;lt;url&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bash shebang&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;!/bin/bash

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Pipes and Filters
&lt;/h1&gt;

&lt;p&gt;Chain filter commands using the pipe operator&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls | sort -r
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pipe the output of manual page for ls to head to display the first 20 lines&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;man ls | head -20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Shell and Environment Variables
&lt;/h1&gt;

&lt;p&gt;List all shell variables&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;set
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Define a shell variable called my_planet and assign value Earth to it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my_planet=Earth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Display shell variable&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo $my_planet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List all environment variables&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Environment vars: define/extend variable scope to child processes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export my_planet
export my_galaxy='Milky Way'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Metacharacters
&lt;/h1&gt;

&lt;p&gt;Comments&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# The shell will not respond to this message
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Command separator&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo 'here are some files and folders'; ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;File name expansion wildcard&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls *.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Single character wildcard&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls file_2021-06-??.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Quoting
&lt;/h1&gt;

&lt;p&gt;Single quotes - interpret literally&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo 'My home directory can be accessed by entering: echo $HOME'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Double quotes - interpret literally, but evaluate metacharacters&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "My home directory is $HOME"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Backslash - escape metacharacter interpretation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "This dollar sign should render: \$"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  I/O Redirection
&lt;/h1&gt;

&lt;p&gt;Redirect output to file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo 'Write this text to file x' &amp;gt; x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Append output to file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo 'Add this line to file x' &amp;gt;&amp;gt; x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Redirect standard error to file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bad_command_1 2&amp;gt; error.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Append standard error to file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bad_command_2 2&amp;gt;&amp;gt; error.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Redirect file contents to standard input&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ tr “[a-z]” “[A-Z]” &amp;lt; a_text_file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The input redirection above is equivalent to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$cat a_text_file.txt | tr “[a-z]” “[A-Z]”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Command Substitution
&lt;/h1&gt;

&lt;p&gt;Capture output of a command and echo its value&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;THE_PRESENT=$(date)
echo "There is no time like $THE_PRESENT"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Command line arguments
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./My_Bash_Script.sh arg1 arg2 arg3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Batch vs. concurrent modes&lt;br&gt;
 Run commands sequentially&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;start=$(date); ./MyBigScript.sh ; end=$(date)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run commands in parallel&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./ETL_chunk_one_on_these_nodes.sh &amp;amp; ./ETL_chunk_two_on_those_nodes.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Scheduling jobs with Cron
&lt;/h1&gt;

&lt;p&gt;Open crontab editor&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;crontab -e
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Job scheduling syntax&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;m h dom mon dow command
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;minute, hour, day of month, month, day of week&lt;br&gt;
'*' means any&lt;/p&gt;

&lt;p&gt;Append the date/time to file every Sunday at 6:15 pm&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;15 18 * * 0 date &amp;gt;&amp;gt; sundays.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run a shell script on the first minute of the first day of each month&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 0 1 * * ./My_Shell_Script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back up your home directory every Monday at 3 am&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 3 * * 1 tar -cvf my_backup_path\my_archive.tar.gz $HOME\
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deploy your cron job&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Close the crontab editor and save the file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List all cron jobs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;crontab -l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>📝 Learn JavaScript the right way with this beginner's cheat sheet</title>
      <dc:creator>Prajwal k</dc:creator>
      <pubDate>Fri, 10 Jun 2022 16:02:08 +0000</pubDate>
      <link>https://dev.to/prajwal056/learn-javascript-the-right-way-with-this-beginners-cheat-sheet-3m85</link>
      <guid>https://dev.to/prajwal056/learn-javascript-the-right-way-with-this-beginners-cheat-sheet-3m85</guid>
      <description>&lt;h2&gt;
  
  
  Table of contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Fundamentals&lt;/li&gt;
&lt;li&gt;Variables&lt;/li&gt;
&lt;li&gt;Data Types&lt;/li&gt;
&lt;li&gt;Operators&lt;/li&gt;
&lt;li&gt;Functions&lt;/li&gt;
&lt;li&gt;Array&lt;/li&gt;
&lt;li&gt;Loops&lt;/li&gt;
&lt;li&gt;If-Else&lt;/li&gt;
&lt;li&gt;Strings&lt;/li&gt;
&lt;li&gt;Regular Expression&lt;/li&gt;
&lt;li&gt;Data Transformation&lt;/li&gt;
&lt;li&gt;Dealing with Dates in JavaScript&lt;/li&gt;
&lt;li&gt;Document Object Model (DOM) in JavaScript&lt;/li&gt;
&lt;li&gt;JavaScript Numbers &amp;amp; Math&lt;/li&gt;
&lt;li&gt;Events&lt;/li&gt;
&lt;li&gt;Error&lt;/li&gt;
&lt;li&gt;Working With Browser&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. JavaScript Fundamentals &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Here are the basics on how to add JavaScript to your website.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;In HTML code, JavaScript is written as follows&lt;/strong&gt;:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Adding JavaScript code to an HTML page requires it to be enclosed within the &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script type = "text/javascript"&amp;gt;
//JavaScript coding can be done inside this tag
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using this input, the browser can correctly identify and execute the code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Including external JavaScript files in an HTML file&lt;/strong&gt;:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is also possible to create a separate JavaScript file and include it within our HTML file. &lt;/p&gt;

&lt;p&gt;Keeping different types of code separate will result in better-organized files, and different kinds of codes can be kept isolated from one another. &lt;/p&gt;

&lt;p&gt;We can, for example, include our JavaScript code in our HTML file in the following manner if our JavaScript code is in the file script.js:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Including Comments&lt;/strong&gt;:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Leaving comments in your code helps other people understand what you're doing or reminds you if you've forgotten something. &lt;br&gt;
Note: To prevent the browser from trying to execute them, they must be properly marked.&lt;/p&gt;

&lt;p&gt;In JavaScript you have two different options:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Single-line comments&lt;/strong&gt;— Whenever you want to include a comment that is limited to a single line, precede it with &lt;code&gt;//&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Multi-line comments&lt;/strong&gt; — If you want to include a long comment between several lines, wrap it in &lt;code&gt;/*&lt;/code&gt; and &lt;code&gt;*/&lt;/code&gt; to avoid it being executed&lt;/p&gt;
&lt;h2&gt;
  
  
  2. JavaScript Variables &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;JavaScript variables are simply storage locations named by their names. &lt;/p&gt;

&lt;p&gt;Thus, we can use them in our JavaScript codes as stand-in values through which we can perform various operations. &lt;/p&gt;

&lt;p&gt;There are three ways to use variables in JavaScript:&lt;br&gt;
&lt;code&gt;var&lt;/code&gt; — The most common variable. It can be reassigned but only accessed within a function.  with var move to the top when the code is executed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var x = 140; //  variable x can be reassigned a new value and also redeclared
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;const&lt;/code&gt; — Cannot be reassigned and are not accessible until they appear in a program.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const x = 5; // variable x cannot be reassigned a new value or redeclared
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;let&lt;/code&gt;— Like const, the let variable can be reassigned but not re-declared.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let x = 202; // variable x cannot be redeclared but can be reassigned a new value
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. JavaScript Data Types &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Variables in JavaScript can store a variety of values and data. You use the equals to "=" operator to assign values to JavaScript variables. JavaScript has the following data types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Numbers: 
These can either be real numbers or integers.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var id = 50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Variables: 
Unlike a fixed value, a variable data type does not have a fixed value.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Text (strings): 
Strings are the most basic types of JavaScript data.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var demoString = "Hello! World"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Operations: 
JavaScript variables can be assigned operations.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var mul = 10*9
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Boolean Values:
True or false are the only two types of Boolean values.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var booleanValue = true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Constant numbers: These data types have a constant value.const
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;l = 8.8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;JavaScript objects: These are containers for properties that have names. JavaScript objects have methods and members.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var name = {name:"Jon Snow", id:"AS123"}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7x17kvn5mirrzos97t9q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7x17kvn5mirrzos97t9q.png" alt="FlowChartDataType"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. JavaScript Operators &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Having variables allows you to perform various types of operations on them. Operators allow you to do this.&lt;/p&gt;

&lt;p&gt;There are 4 types of Operators&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Fundamental Operators:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;Addition&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;Subtraction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;*&lt;/td&gt;
&lt;td&gt;Multiplication&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;/&lt;/td&gt;
&lt;td&gt;Division&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(...)&lt;/td&gt;
&lt;td&gt;Grouping operator, operations within brackets are executed earlier than those outside&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;%&lt;/td&gt;
&lt;td&gt;Modulus (remainder )&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;++&lt;/td&gt;
&lt;td&gt;Increment numbers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;--&lt;/td&gt;
&lt;td&gt;Decrement numbers&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Bitwise Operators:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;amp;&lt;/td&gt;
&lt;td&gt;AND statement&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;~&lt;/td&gt;
&lt;td&gt;NOT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;^&lt;/td&gt;
&lt;td&gt;XOR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;&amp;lt;&lt;/td&gt;
&lt;td&gt;Left shift&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;gt;&amp;gt;&lt;/td&gt;
&lt;td&gt;Right shift&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/td&gt;
&lt;td&gt;Zero fill right shift&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Comparison Operators:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;==&lt;/td&gt;
&lt;td&gt;Equal to&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;===&lt;/td&gt;
&lt;td&gt;Equal value and equal type&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;!=&lt;/td&gt;
&lt;td&gt;Not equal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;!==&lt;/td&gt;
&lt;td&gt;Not equal value or not equal type&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;gt;&lt;/td&gt;
&lt;td&gt;Greater than&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;&lt;/td&gt;
&lt;td&gt;Less than&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;gt;=&lt;/td&gt;
&lt;td&gt;Greater than or equal to&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;lt;=&lt;/td&gt;
&lt;td&gt;Less than or equal to&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;?&lt;/td&gt;
&lt;td&gt;Ternary operator&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Logical Operators:&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;amp;&amp;amp;&lt;/td&gt;
&lt;td&gt;Logical and&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;!&lt;/td&gt;
&lt;td&gt;Logical not&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  5. JavaScript Functions &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;The JavaScript function is a block of code that performs a particular task. They look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function nameOfTheFunction(parameterOne, parameterTwo, parameterThree, parameterFour,....,parameterN) {
   // Job or Task of the function 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Function for outputting data&lt;/strong&gt;
Functions are commonly used to output data. 
There are several options for the output:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Function&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;alert()&lt;/td&gt;
&lt;td&gt;Output data in an alert box in the browser window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;confirm()&lt;/td&gt;
&lt;td&gt;Opens up a yes/no dialog and returns true/false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;console.log()&lt;/td&gt;
&lt;td&gt;Writes information to the browser console, good for debugging purposes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;document.write()&lt;/td&gt;
&lt;td&gt;Write directly to the HTML document&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;prompt()&lt;/td&gt;
&lt;td&gt;Creates a dialogue for user input&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global Functions&lt;/strong&gt;
Global functions are functions built into every browser capable of running JavaScript.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Function&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;decodeURI()&lt;/td&gt;
&lt;td&gt;Decodes a Uniform Resource Identifier (URI) created by encodeURI or similar&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;decodeURIComponent()&lt;/td&gt;
&lt;td&gt;Decodes a URI component&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;encodeURI()&lt;/td&gt;
&lt;td&gt;Encodes a URI into UTF-8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;encodeURIComponent()&lt;/td&gt;
&lt;td&gt;Same but for URI components&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;eval()&lt;/td&gt;
&lt;td&gt;Evaluates JavaScript code represented as a string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;isFinite()&lt;/td&gt;
&lt;td&gt;Determines whether a passed value is a finite number&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;isNaN()&lt;/td&gt;
&lt;td&gt;Determines whether a value is NaN or not&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Number()&lt;/td&gt;
&lt;td&gt;Returns a number converted from its argument&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;parseFloat()&lt;/td&gt;
&lt;td&gt;Parses an argument and returns a floating-point number&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;parseInt()&lt;/td&gt;
&lt;td&gt;Parses its argument and returns an integer&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  6. JavaScript Arrays &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;An array is a special variable, which can hold more than one value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const cars = ["Saab", "Volvo", "BMW"];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Array Methods&lt;/strong&gt;:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which can be used to perform various types of operations. &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;pop()&lt;/td&gt;
&lt;td&gt;This method is used for removing the last element of an array.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;push()&lt;/td&gt;
&lt;td&gt;This method is used for adding a new element at the very end of an array.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;concat()&lt;/td&gt;
&lt;td&gt;This method is used for joining various arrays into a single array.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;reverse()&lt;/td&gt;
&lt;td&gt;This method is used for reversing the order of the elements in an array.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;shift()&lt;/td&gt;
&lt;td&gt;This method is used for removing the first element of an array.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;slice()&lt;/td&gt;
&lt;td&gt;This method is used for pulling a copy of a part of an array into a new array.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;splice()&lt;/td&gt;
&lt;td&gt;This method is used for adding elements in a particular way and position.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;toString()&lt;/td&gt;
&lt;td&gt;This method is used for converting the array elements into strings.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;unshift()&lt;/td&gt;
&lt;td&gt;This method is used for adding new elements at the beginning of the array.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;valueOf()&lt;/td&gt;
&lt;td&gt;This method is used for returning the primitive value of the given object.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;indexOf()&lt;/td&gt;
&lt;td&gt;This method is used for returning the first index at which a given element is found in an array.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lastIndexOf()&lt;/td&gt;
&lt;td&gt;This method is used for returning the final index at which a given element appears in an array.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;join()&lt;/td&gt;
&lt;td&gt;This method is used for combining elements of an array into one single string and then returning it.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sort()&lt;/td&gt;
&lt;td&gt;This method is used for sorting the array elements based on some condition.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;An array is a special variable, which can hold more than one value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const cars = ["Saab", "Volvo", "BMW"];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. JavaScript Loops &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Almost all programming languages include loops. It allows you to run blocks of code indefinitely with different values:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;for&lt;/code&gt; loop: JavaScript's most common method for creating loops.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for (initialization of the loop variable; condition checking for the loop; updation after the loop) {
   // code to be executed in loop
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;while&lt;/code&gt; loop: Determines when a loop should run. 
// Initialization of the loop variable is done before the while loop begins
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;while(condition checking for the loop){
// 1. code to be executed in loop
// 2. updation of the loop variable
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;do-while&lt;/code&gt; loop: Similar to the while loop, it runs at least once and checks whether there is a condition to run it again at the end. 
// Initialization of the loop variable is done before the do-while loop begins
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;do{
// 1. code to be executed in loop
// 2. updation of the loop variable
}while(condition checking for the loop);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When it comes to loops, there are two important statements:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continue statement&lt;/strong&gt;: If certain conditions are met, skip sections of the loop.&lt;br&gt;
&lt;strong&gt;break statement&lt;/strong&gt;: Exit the cycle when a specified condition is met.&lt;/p&gt;
&lt;h2&gt;
  
  
  8. JavaScript If-Else &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;If-else is used in JavaScript to execute a block of codes conditionally. These are used to set conditions for your code block to run. There are situations where certain blocks of code are executed, and there are situations where they are not.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (condition)
{
   // Executes this block if
   // condition is true
}
else
{
   // Executes this block if
   // condition is false
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  9. JavaScript Strings &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;In JavaScript, strings are used to represent text that does not perform a function but can be displayed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var Name = "John Cena";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, John Cena is the string.&lt;/p&gt;

&lt;p&gt;The following are all the escape sequences in JavaScript, as well as methods that JavaScript provides for strings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Escape Characters&lt;/strong&gt;
Using single or double quotes, strings are marked in JavaScript. Special characters are needed for quotation marks in a string:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Character&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;\'&lt;/td&gt;
&lt;td&gt;Single quotes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\"&lt;/td&gt;
&lt;td&gt;Double quotes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\t&lt;/td&gt;
&lt;td&gt;Horizontal tab&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\v&lt;/td&gt;
&lt;td&gt;Vertical tab&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\&lt;/td&gt;
&lt;td&gt;Backslash&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\b&lt;/td&gt;
&lt;td&gt;Backspace&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\f&lt;/td&gt;
&lt;td&gt;Form feed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\n&lt;/td&gt;
&lt;td&gt;Newline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\r&lt;/td&gt;
&lt;td&gt;Carriage return&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;String methods&lt;/strong&gt;: 
Strings can be worked with in many different ways:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;charAt()&lt;/td&gt;
&lt;td&gt;Returns a character at a specified position inside a string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;charCodeAt()&lt;/td&gt;
&lt;td&gt;Gives you the Unicode of a character at that position&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;concat()&lt;/td&gt;
&lt;td&gt;Concatenates (joins) two or more strings into one&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;fromCharCode()&lt;/td&gt;
&lt;td&gt;Returns a string created from the specified sequence of UTF-16 code units&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;indexOf()&lt;/td&gt;
&lt;td&gt;Provides the position of the first occurrence of a specified text within a string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lastIndexOf()&lt;/td&gt;
&lt;td&gt;Same as indexOf() but with the last occurrence, searching backward&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;match()&lt;/td&gt;
&lt;td&gt;Retrieves the matches of a string against a search pattern&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;replace()&lt;/td&gt;
&lt;td&gt;Find and replace specified text in a string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;search()&lt;/td&gt;
&lt;td&gt;Executes a search for a matching text and returns its position&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;slice()&lt;/td&gt;
&lt;td&gt;Extracts a section of a string and returns it as a new string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;split()&lt;/td&gt;
&lt;td&gt;Splits a string object into an array of strings at a specified position&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;substr()&lt;/td&gt;
&lt;td&gt;Similar to slice() but extracts a substring depending on a specified number of characters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;substring()&lt;/td&gt;
&lt;td&gt;Also similar to slice() but can’t accept negative indices&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;toLowerCase()&lt;/td&gt;
&lt;td&gt;Convert strings to lower case&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;toUpperCase()&lt;/td&gt;
&lt;td&gt;Convert strings to upper case&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;valueOf()&lt;/td&gt;
&lt;td&gt;Returns the primitive value (that has no properties or methods) of a string object&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  10. JavaScript Regular Expression &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Strings can be matched by regular expressions, which are search patterns. They can be used for text search and text replacement.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pattern Modifiers&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pattern&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;e&lt;/td&gt;
&lt;td&gt;Evaluate replacement&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;i&lt;/td&gt;
&lt;td&gt;Perform case-insensitive matching&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;g&lt;/td&gt;
&lt;td&gt;Perform global matching&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;m&lt;/td&gt;
&lt;td&gt;Perform multiple line matching&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s&lt;/td&gt;
&lt;td&gt;Treat strings as a single line&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;x&lt;/td&gt;
&lt;td&gt;Allow comments and whitespace in the pattern&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;U&lt;/td&gt;
&lt;td&gt;Ungreedy pattern&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Brackets&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;[abc]&lt;/td&gt;
&lt;td&gt;Find any of the characters between the brackets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;[^abc]&lt;/td&gt;
&lt;td&gt;Find any character which is not in the brackets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;[0-9]&lt;/td&gt;
&lt;td&gt;Used to find any digit from 0 to 9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;[A-z]&lt;/td&gt;
&lt;td&gt;Find any character from uppercase A to lowercase z&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;(a&lt;/td&gt;
&lt;td&gt;b&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Metacharacters&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;.&lt;/td&gt;
&lt;td&gt;Find a single character, except newline or line terminator&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\w&lt;/td&gt;
&lt;td&gt;Word character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;\W&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\d&lt;/td&gt;
&lt;td&gt;A digit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\D&lt;/td&gt;
&lt;td&gt;A non-digit character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\s&lt;/td&gt;
&lt;td&gt;Whitespace character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\S&lt;/td&gt;
&lt;td&gt;Non-whitespace character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\b&lt;/td&gt;
&lt;td&gt;Find a match at the beginning/end of a word&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\B&lt;/td&gt;
&lt;td&gt;A match not at the beginning/end of a word&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\0&lt;/td&gt;
&lt;td&gt;NUL character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\n&lt;/td&gt;
&lt;td&gt;A new line character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\f&lt;/td&gt;
&lt;td&gt;Form feed character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\r&lt;/td&gt;
&lt;td&gt;Carriage return character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\t&lt;/td&gt;
&lt;td&gt;Tab character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\v&lt;/td&gt;
&lt;td&gt;Vertical tab character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\xxx&lt;/td&gt;
&lt;td&gt;The character specified by an octal number xxx&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\xdd&lt;/td&gt;
&lt;td&gt;Character specified by a hexadecimal number dd&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;\uxxxx&lt;/td&gt;
&lt;td&gt;The Unicode character specified by a hexadecimal number XXXX&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Quantifiers&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;n+&lt;/td&gt;
&lt;td&gt;Matches any string that contains at least one n&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;n*&lt;/td&gt;
&lt;td&gt;Any string that contains zero or more occurrences of n&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;n?&lt;/td&gt;
&lt;td&gt;A string that contains zero or one occurrence of n&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;n{X}&lt;/td&gt;
&lt;td&gt;String that contains a sequence of X n’s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;n{X,Y}&lt;/td&gt;
&lt;td&gt;Strings that contain a sequence of X to Y n’s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;n{X,}&lt;/td&gt;
&lt;td&gt;Matches any string that contains a sequence of at least X n’s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;n$&lt;/td&gt;
&lt;td&gt;Any string with n at the end of it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;^n&lt;/td&gt;
&lt;td&gt;String with n at the beginning of it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;?=n&lt;/td&gt;
&lt;td&gt;Any string that is followed by a specific string n&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;?!n&lt;/td&gt;
&lt;td&gt;String that is not followed by a specific string ni&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  11. Data Transformation &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;'Data transformation' is the conversion of one format to another. Using higher-order JavaScript functions, you can transform data by taking two or more functions as inputs and returning a function as a consequence. Map(), filter(), and reduce() are all higher-order functions that take a function as input.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Map()&lt;/code&gt;&lt;/strong&gt;
By calling a specific function on each element of a parent array, JavaScript's map() method creates an array. Iterating over an array and calling functions on every element is accomplished using
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;map(), a non-mutating method.
var arr = [10,20,30];
var triple  = arr.map(x =&amp;gt; x * 3);
triple; // [30,60,90]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;filter()&lt;/code&gt;&lt;/strong&gt;
With arr.filter(), a new array is generated that consists only of those elements in a given array that meet a given set of conditions and criteria.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var arr = [13,40,47];
var odd = arr.filter(x =&amp;gt; x % 2);
odd; // [13,47]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Reduce()&lt;/code&gt;&lt;/strong&gt;
When used in JavaScript, the arr.reduce() method reduces a given array to a single value by running a function provided for each value (from left-to-right), and storing the output in an accumulator.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var arr = [10,20,30];
var counter = 0;
let answer = arr.reduce((accumulator, value) =&amp;gt; value + accumulator, counter);
console.log(answer) // answer = 10 + 20 + 30 = 60
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  12. Dealing with Dates in JavaScript &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Dealing with Dates in JavaScript&lt;br&gt;
You can also work with and modify dates and time with JavaScript. This is the next chapter in the JavaScript cheat sheet.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Setting Dates&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Date()&lt;/td&gt;
&lt;td&gt;Creates a new date object with the current date and time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Date(2017, 5, 21, 3, 23, 10, 0)&lt;/td&gt;
&lt;td&gt;Create a custom date object.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Date("2017-06-23")&lt;/td&gt;
&lt;td&gt;Date declaration as a string&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pulling Date and Time Values&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;getDate()&lt;/td&gt;
&lt;td&gt;Get the day of the month as a number (1-31)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getDay()&lt;/td&gt;
&lt;td&gt;The weekday as a number (0-6)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getFullYear()&lt;/td&gt;
&lt;td&gt;Year as a four-digit number (yyyy)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getHours()&lt;/td&gt;
&lt;td&gt;Get the hour (0-23)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getMilliseconds()&lt;/td&gt;
&lt;td&gt;The millisecond (0-999)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getMinutes()&lt;/td&gt;
&lt;td&gt;Get the minute (0-59)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getMonth()&lt;/td&gt;
&lt;td&gt;Month as a number (0-11)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getSeconds()&lt;/td&gt;
&lt;td&gt;Get the second (0-59)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getTime()&lt;/td&gt;
&lt;td&gt;Get the milliseconds since January 1, 1970&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getUTCDate()&lt;/td&gt;
&lt;td&gt;The day (date) of the month in the specified date according to universal time (also available for day, month, full year, hours, minutes etc.)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;parse&lt;/td&gt;
&lt;td&gt;Parses a string representation of a date and returns the number of milliseconds since January 1, 1970&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Set Part of a Date&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;setDate()&lt;/td&gt;
&lt;td&gt;Set the day as a number (1-31)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setFullYear()&lt;/td&gt;
&lt;td&gt;Sets the year (optionally month and day)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setHours()&lt;/td&gt;
&lt;td&gt;Set the hour (0-23)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setMilliseconds()&lt;/td&gt;
&lt;td&gt;Set milliseconds (0-999)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setMinutes()&lt;/td&gt;
&lt;td&gt;Sets the minutes (0-59)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setMonth()&lt;/td&gt;
&lt;td&gt;Set the month (0-11)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setSeconds()&lt;/td&gt;
&lt;td&gt;Sets the seconds (0-59)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setTime()&lt;/td&gt;
&lt;td&gt;Set the time (milliseconds since January 1, 1970)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setUTCDate()&lt;/td&gt;
&lt;td&gt;Sets the day of the month for a specified date according to universal time (also available for day, month, full year, hours, minutes etc.)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  13. Document Object Model (DOM) in JavaScript &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;A website's code is organized into Document Object Models (DOMs). JavaScript allows you to build and alter HTML elements (called nodes) in many different ways. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Node Properties&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;attributes&lt;/td&gt;
&lt;td&gt;Returns a live collection of all attributes registered to an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;baseURI&lt;/td&gt;
&lt;td&gt;Provides the absolute base URL of an HTML element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;childNodes&lt;/td&gt;
&lt;td&gt;Gives a collection of an element’s child nodes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;firstChild&lt;/td&gt;
&lt;td&gt;Returns the first child node of an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lastChild&lt;/td&gt;
&lt;td&gt;The last child node of an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;nextSibling&lt;/td&gt;
&lt;td&gt;Gives you the next node at the same node tree level&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;nodeName&lt;/td&gt;
&lt;td&gt;Returns the name of a node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;nodeType&lt;/td&gt;
&lt;td&gt;Returns the type of a node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;nodeValue&lt;/td&gt;
&lt;td&gt;Sets or returns the value of a node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ownerDocument&lt;/td&gt;
&lt;td&gt;The top-level document object for this node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;parentNode&lt;/td&gt;
&lt;td&gt;Returns the parent node of an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;previousSibling&lt;/td&gt;
&lt;td&gt;Returns the node immediately preceding the current one&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;textContent&lt;/td&gt;
&lt;td&gt;Sets or returns the textual content of a node and its descendants&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Node Methods&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;appendChild()&lt;/td&gt;
&lt;td&gt;Adds a new child node to an element as the last child node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cloneNode()&lt;/td&gt;
&lt;td&gt;Clones an HTML element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;compareDocumentPosition()&lt;/td&gt;
&lt;td&gt;Compares the document position of two elements&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getFeature()&lt;/td&gt;
&lt;td&gt;Returns an object which implements the APIs of a specified feature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;hasAttributes()&lt;/td&gt;
&lt;td&gt;Returns true if an element has any attributes, otherwise false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;hasChildNodes()&lt;/td&gt;
&lt;td&gt;Returns true if an element has any child nodes, otherwise false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;insertBefore()&lt;/td&gt;
&lt;td&gt;Inserts a new child node before a specified, existing child node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;isDefaultNamespace()&lt;/td&gt;
&lt;td&gt;Returns true if a specified namespaceURI is the default, otherwise false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;isEqualNode()&lt;/td&gt;
&lt;td&gt;Checks if two elements are equal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;isSameNode()&lt;/td&gt;
&lt;td&gt;Checks if two elements are the same node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;isSupported()&lt;/td&gt;
&lt;td&gt;Returns true if a specified feature is supported on the element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lookupNamespaceURI()&lt;/td&gt;
&lt;td&gt;Returns the namespace URI associated with a given node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lookupPrefix()&lt;/td&gt;
&lt;td&gt;Returns a DOMString containing the prefix for a given namespace URI if present&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;normalize()&lt;/td&gt;
&lt;td&gt;Joins adjacent text nodes and removes empty text nodes in an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;removeChild()&lt;/td&gt;
&lt;td&gt;Removes a child node from an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;replaceChild()&lt;/td&gt;
&lt;td&gt;Replaces a child node in an element&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Element Methods&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;getAttribute()&lt;/td&gt;
&lt;td&gt;Returns the specified attribute value of an element node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getAttributeNS()&lt;/td&gt;
&lt;td&gt;Returns string value of the attribute with the specified namespace and name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getAttributeNode()&lt;/td&gt;
&lt;td&gt;Gets the specified attribute node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getAttributeNodeNS()&lt;/td&gt;
&lt;td&gt;Returns the attribute node for the attribute with the given namespace and name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getElementsByTagName()&lt;/td&gt;
&lt;td&gt;Provides a collection of all child elements with the specified tag name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;getElementsByTagNameNS()&lt;/td&gt;
&lt;td&gt;Returns a live HTMLCollection of elements with a certain tag name belonging to the given namespace&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;hasAttribute()&lt;/td&gt;
&lt;td&gt;Returns true if an element has any attributes, otherwise false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;hasAttributeNS()&lt;/td&gt;
&lt;td&gt;Provides a true/false value indicating whether the current element in a given namespace has the specified attribute&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;removeAttribute()&lt;/td&gt;
&lt;td&gt;Removes a specified attribute from an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;removeAttributeNS()&lt;/td&gt;
&lt;td&gt;Removes the specified attribute from an element within a certain namespace&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;removeAttributeNode()&lt;/td&gt;
&lt;td&gt;Takes away a specified attribute node and returns the removed node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setAttribute()&lt;/td&gt;
&lt;td&gt;Sets or changes the specified attribute to a specified value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setAttributeNS()&lt;/td&gt;
&lt;td&gt;Adds a new attribute or changes the value of an attribute with the given namespace and name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setAttributeNode()&lt;/td&gt;
&lt;td&gt;Sets or changes the specified attribute node&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setAttributeNodeNS()&lt;/td&gt;
&lt;td&gt;Adds a new namespaced attribute node to an element&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  14. JavaScript Numbers &amp;amp; Math &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Mathematical functions and constants can also be performed in JavaScript.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Number Properties&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;MAX_VALUE&lt;/td&gt;
&lt;td&gt;The maximum numeric value representable in JavaScript&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MIN_VALUE&lt;/td&gt;
&lt;td&gt;Smallest positive numeric value representable in JavaScript&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NaN&lt;/td&gt;
&lt;td&gt;The “Not-a-Number” value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NEGATIVE_INFINITY&lt;/td&gt;
&lt;td&gt;The negative Infinity value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;POSITIVE_INFINITY&lt;/td&gt;
&lt;td&gt;Positive Infinity value&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Number Methods&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;toExponential()&lt;/td&gt;
&lt;td&gt;Returns the string with a rounded number written as exponential notation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;toFixed()&lt;/td&gt;
&lt;td&gt;Returns the string of a number with a specified number of decimals&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;toPrecision()&lt;/td&gt;
&lt;td&gt;String of a number written with a specified length&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;toString()&lt;/td&gt;
&lt;td&gt;Returns a number as a string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;valueOf()&lt;/td&gt;
&lt;td&gt;Returns a number as a number&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Math Properties&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;E&lt;/td&gt;
&lt;td&gt;Euler’s number&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LN2&lt;/td&gt;
&lt;td&gt;The natural logarithm of 2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LN10&lt;/td&gt;
&lt;td&gt;Natural logarithm of 10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LOG2E&lt;/td&gt;
&lt;td&gt;Base 2 logarithm of E&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LOG10E&lt;/td&gt;
&lt;td&gt;Base 10 logarithm of E&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PI&lt;/td&gt;
&lt;td&gt;The number PI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SQRT1_2&lt;/td&gt;
&lt;td&gt;Square root of 1/2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SQRT2&lt;/td&gt;
&lt;td&gt;The square root of 2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Math Methods&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;abs(x)&lt;/td&gt;
&lt;td&gt;Returns the absolute (positive) value of x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;acos(x)&lt;/td&gt;
&lt;td&gt;The arccosine of x, in radians&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;asin(x)&lt;/td&gt;
&lt;td&gt;Arcsine of x, in radians&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;atan(x)&lt;/td&gt;
&lt;td&gt;The arctangent of x as a numeric value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;atan2(y,x)&lt;/td&gt;
&lt;td&gt;Arctangent of the quotient of its arguments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ceil(x)&lt;/td&gt;
&lt;td&gt;Value of x rounded up to its nearest integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cos(x)&lt;/td&gt;
&lt;td&gt;The cosine of x (x is in radians)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;exp(x)&lt;/td&gt;
&lt;td&gt;Value of Ex&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;floor(x)&lt;/td&gt;
&lt;td&gt;The value of x rounded down to its nearest integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;log(x)&lt;/td&gt;
&lt;td&gt;The natural logarithm (base E) of x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;max(x,y,z,...,n)&lt;/td&gt;
&lt;td&gt;Returns the number with the highest value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;min(x,y,z,...,n)&lt;/td&gt;
&lt;td&gt;Same for the number with the lowest value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pow(x,y)&lt;/td&gt;
&lt;td&gt;X to the power of y&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;random()&lt;/td&gt;
&lt;td&gt;Returns a random number between 0 and 1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;round(x)&lt;/td&gt;
&lt;td&gt;The value of x rounded to its nearest integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sin(x)&lt;/td&gt;
&lt;td&gt;The sine of x (x is in radians)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sqrt(x)&lt;/td&gt;
&lt;td&gt;Square root of x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;tan(x)&lt;/td&gt;
&lt;td&gt;The tangent of an angle&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  15. JavaScript Events &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Events are things that can happen to HTML elements and are performed by the user. The programming language can listen for these events and trigger actions in the code. No JavaScript cheat sheet would be complete without them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mouse&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;onclick&lt;/td&gt;
&lt;td&gt;The event occurs when the user clicks on an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;oncontextmenu&lt;/td&gt;
&lt;td&gt;User right-clicks on an element to open a context menu&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ondblclick&lt;/td&gt;
&lt;td&gt;The user double-clicks on an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onmousedown&lt;/td&gt;
&lt;td&gt;User presses a mouse button over an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onmouseenter&lt;/td&gt;
&lt;td&gt;The pointer moves onto an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onmouseleave&lt;/td&gt;
&lt;td&gt;Pointer moves out of an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onmousemove&lt;/td&gt;
&lt;td&gt;The pointer is moving while it is over an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onmouseover&lt;/td&gt;
&lt;td&gt;When the pointer is moved onto an element or one of its children&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onmouseout&lt;/td&gt;
&lt;td&gt;User moves the mouse pointer out of an element or one of its children&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onmouseup&lt;/td&gt;
&lt;td&gt;The user releases a mouse button while over an element&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Keyboard&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;onkeydown&lt;/td&gt;
&lt;td&gt;When the user is pressing a key down&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onkeypress&lt;/td&gt;
&lt;td&gt;The moment the user starts pressing a key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onkeyup&lt;/td&gt;
&lt;td&gt;The user releases a key&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Frame&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;onabort&lt;/td&gt;
&lt;td&gt;The loading of a media is aborted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onbeforeunload&lt;/td&gt;
&lt;td&gt;Event occurs before the document is about to be unloaded&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onerror&lt;/td&gt;
&lt;td&gt;An error occurs while loading an external file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onhashchange&lt;/td&gt;
&lt;td&gt;There have been changes to the anchor part of a URL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onload&lt;/td&gt;
&lt;td&gt;When an object has loaded&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onpagehide&lt;/td&gt;
&lt;td&gt;The user navigates away from a webpage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onpageshow&lt;/td&gt;
&lt;td&gt;When the user navigates to a webpage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onresize&lt;/td&gt;
&lt;td&gt;The document view is resized&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onscroll&lt;/td&gt;
&lt;td&gt;An element’s scrollbar is being scrolled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onunload&lt;/td&gt;
&lt;td&gt;Event occurs when a page has unloaded&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Form&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;onblur&lt;/td&gt;
&lt;td&gt;When an element loses focus&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onchange&lt;/td&gt;
&lt;td&gt;The content of a form element changes (for ,  and )&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onfocus&lt;/td&gt;
&lt;td&gt;An element gets focus&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onfocusin&lt;/td&gt;
&lt;td&gt;When an element is about to get focus&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onfocusout&lt;/td&gt;
&lt;td&gt;The element is about to lose focus&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;oninput&lt;/td&gt;
&lt;td&gt;User input on an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;oninvalid&lt;/td&gt;
&lt;td&gt;An element is invalid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onreset&lt;/td&gt;
&lt;td&gt;A form is reset&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onsearch&lt;/td&gt;
&lt;td&gt;The user writes something in a search field (for )&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onselect&lt;/td&gt;
&lt;td&gt;The user selects some text (for  and )&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onsubmit&lt;/td&gt;
&lt;td&gt;A form is submitted&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Drag&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ondrag&lt;/td&gt;
&lt;td&gt;An element is dragged&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ondragend&lt;/td&gt;
&lt;td&gt;The user has finished dragging the element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ondragenter&lt;/td&gt;
&lt;td&gt;The dragged element enters a drop target&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ondragleave&lt;/td&gt;
&lt;td&gt;A dragged element leaves the drop target&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ondragover&lt;/td&gt;
&lt;td&gt;The dragged element is on top of the drop target&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ondragstart&lt;/td&gt;
&lt;td&gt;User starts to drag an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ondrop&lt;/td&gt;
&lt;td&gt;Dragged element is dropped on the drop target&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Clipboard&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;oncopy&lt;/td&gt;
&lt;td&gt;User copies the content of an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;oncut&lt;/td&gt;
&lt;td&gt;The user cuts an element’s content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onpaste&lt;/td&gt;
&lt;td&gt;A user pastes the content in an element&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Media&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;onabort&lt;/td&gt;
&lt;td&gt;Media loading is aborted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;oncanplay&lt;/td&gt;
&lt;td&gt;The browser can start playing media (e.g. a file has buffered enough)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;oncanplaythrough&lt;/td&gt;
&lt;td&gt;The browser can play through media without stopping&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ondurationchange&lt;/td&gt;
&lt;td&gt;The duration of the media changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onended&lt;/td&gt;
&lt;td&gt;The media has reached its end&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onerror&lt;/td&gt;
&lt;td&gt;Happens when an error occurs while loading an external file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onloadeddata&lt;/td&gt;
&lt;td&gt;Media data is loaded&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onloadedmetadata&lt;/td&gt;
&lt;td&gt;Metadata (like dimensions and duration) are loaded&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onloadstart&lt;/td&gt;
&lt;td&gt;The browser starts looking for specified media&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onpause&lt;/td&gt;
&lt;td&gt;Media is paused either by the user or automatically&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onplay&lt;/td&gt;
&lt;td&gt;The media has been started or is no longer paused&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onplaying&lt;/td&gt;
&lt;td&gt;Media is playing after having been paused or stopped for buffering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onprogress&lt;/td&gt;
&lt;td&gt;The browser is in the process of downloading the media&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onratechange&lt;/td&gt;
&lt;td&gt;The playing speed of the media changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onseeked&lt;/td&gt;
&lt;td&gt;User is finished moving/skipping to a new position in the media&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onseeking&lt;/td&gt;
&lt;td&gt;The user starts moving/skipping&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onstalled&lt;/td&gt;
&lt;td&gt;The browser is trying to load the media but it is not available&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onsuspend&lt;/td&gt;
&lt;td&gt;The browser is intentionally not loading media&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ontimeupdate&lt;/td&gt;
&lt;td&gt;The playing position has changed (e.g. because of fast forward)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onvolumechange&lt;/td&gt;
&lt;td&gt;Media volume has changed (including mute)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onwaiting&lt;/td&gt;
&lt;td&gt;Media paused but expected to resume (for example, buffering)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Animation&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;animationend&lt;/td&gt;
&lt;td&gt;A CSS animation is complete&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;animationiteration&lt;/td&gt;
&lt;td&gt;CSS animation is repeated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;animationstart&lt;/td&gt;
&lt;td&gt;CSS animation has started&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Other&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;transitionend&lt;/td&gt;
&lt;td&gt;Fired when a CSS transition has completed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onmessage&lt;/td&gt;
&lt;td&gt;A message is received through the event source&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onoffline&lt;/td&gt;
&lt;td&gt;The browser starts to work offline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ononline&lt;/td&gt;
&lt;td&gt;The browser starts to work online&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onpopstate&lt;/td&gt;
&lt;td&gt;When the window’s history changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onshow&lt;/td&gt;
&lt;td&gt;A  element is shown as a context menu&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onstorage&lt;/td&gt;
&lt;td&gt;A Web Storage area is updated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ontoggle&lt;/td&gt;
&lt;td&gt;The user opens or closes the  element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;onwheel&lt;/td&gt;
&lt;td&gt;Mouse wheel rolls up or down over an element&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ontouchcancel&lt;/td&gt;
&lt;td&gt;Screen-touch is interrupted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ontouchend&lt;/td&gt;
&lt;td&gt;User’s finger is removed from a touch-screen&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ontouchmove&lt;/td&gt;
&lt;td&gt;A finger is dragged across the screen&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ontouchstart&lt;/td&gt;
&lt;td&gt;A finger is placed on the touch-screen&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  16. JavaScript Errors &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;When working with JavaScript, different errors can occur. There are several ways of handling them:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;try&lt;/td&gt;
&lt;td&gt;Lets you define a block of code to test for errors&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;catch&lt;/td&gt;
&lt;td&gt;Set up a block of code to execute in case of an error&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;throw&lt;/td&gt;
&lt;td&gt;Create custom error messages instead of the standard JavaScript errors&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;finally&lt;/td&gt;
&lt;td&gt;Lets you execute code, after try and catch, regardless of the result&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Error Name Values&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;JavaScript also has a built-in error object. It has two properties:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;name&lt;/td&gt;
&lt;td&gt;Sets or returns the error name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;message&lt;/td&gt;
&lt;td&gt;Sets or returns an error message in a string from&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The error property can return six different values as its name:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;EvalError&lt;/td&gt;
&lt;td&gt;An error has occurred in the eval() function&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RangeError&lt;/td&gt;
&lt;td&gt;A number is “out of range”&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ReferenceError&lt;/td&gt;
&lt;td&gt;An illegal reference has occurred&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SyntaxError&lt;/td&gt;
&lt;td&gt;A syntax error has occurred&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TypeError&lt;/td&gt;
&lt;td&gt;A type error has occurred&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;URIError&lt;/td&gt;
&lt;td&gt;An encodeURI() error has occurred&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  17. JavaScript Working With Browser &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Besides HTML elements, JavaScript is also able to take into account the user browser and incorporate its properties into the code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Window Properties&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;closed&lt;/td&gt;
&lt;td&gt;Checks whether a window has been closed or not and returns true or false&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;defaultStatus&lt;/td&gt;
&lt;td&gt;Sets or returns the default text in the status bar of a window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;document&lt;/td&gt;
&lt;td&gt;Returns the document object for the window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;frames&lt;/td&gt;
&lt;td&gt;Returns all  elements in the current window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;history&lt;/td&gt;
&lt;td&gt;Provides the History object for the window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;innerHeight&lt;/td&gt;
&lt;td&gt;The inner height of a window’s content area&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;innerWidth&lt;/td&gt;
&lt;td&gt;The inner width of the content area&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;length&lt;/td&gt;
&lt;td&gt;Find out the number of   elements in the window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;location&lt;/td&gt;
&lt;td&gt;Returns the location object for the window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;name&lt;/td&gt;
&lt;td&gt;Sets or returns the name of a window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;navigator&lt;/td&gt;
&lt;td&gt;Returns the Navigator object for the window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;opener&lt;/td&gt;
&lt;td&gt;Returns a reference to the window that created the window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;outerHeight&lt;/td&gt;
&lt;td&gt;The outer height of a window, including toolbars/scrollbars&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;outerWidth&lt;/td&gt;
&lt;td&gt;The outer width of a window, including toolbars/scrollbars&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pageXOffset&lt;/td&gt;
&lt;td&gt;Number of pixels the current document has been scrolled horizontally&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pageYOffset&lt;/td&gt;
&lt;td&gt;Number of pixels the document has been scrolled vertically&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;parent&lt;/td&gt;
&lt;td&gt;The parent window of the current window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;screen&lt;/td&gt;
&lt;td&gt;Returns the Screen object for the window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;screenLeft&lt;/td&gt;
&lt;td&gt;The horizontal coordinate of the window (relative to the screen)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;screenTop&lt;/td&gt;
&lt;td&gt;The vertical coordinate of the window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;screenX&lt;/td&gt;
&lt;td&gt;Same as screenLeft but needed for some browsers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;screenY&lt;/td&gt;
&lt;td&gt;Same as screenTop but needed for some browsers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;self&lt;/td&gt;
&lt;td&gt;Returns the current window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;status&lt;/td&gt;
&lt;td&gt;Sets or returns the text in the status bar of a window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;top&lt;/td&gt;
&lt;td&gt;Returns the topmost browser window&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Window Methods&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;alert()&lt;/td&gt;
&lt;td&gt;Displays an alert box with a message and an OK button&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;blur()&lt;/td&gt;
&lt;td&gt;Removes focus from the current window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;clearInterval()&lt;/td&gt;
&lt;td&gt;Clears a timer set with setInterval()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;clearTimeout()&lt;/td&gt;
&lt;td&gt;Clears a timer set with setTimeout()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;close()&lt;/td&gt;
&lt;td&gt;Closes the current window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;confirm()&lt;/td&gt;
&lt;td&gt;Displays a dialogue box with a message and an OK and Cancel button&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;focus()&lt;/td&gt;
&lt;td&gt;Sets focus to the current window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;moveBy()&lt;/td&gt;
&lt;td&gt;Moves a window relative to its current position&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;moveTo()&lt;/td&gt;
&lt;td&gt;Moves a window to a specified position&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;open()&lt;/td&gt;
&lt;td&gt;Opens a new browser window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;print()&lt;/td&gt;
&lt;td&gt;Prints the content of the current window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;prompt()&lt;/td&gt;
&lt;td&gt;Displays a dialogue box that prompts the visitor for input&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;resizeBy()&lt;/td&gt;
&lt;td&gt;Resizes the window by the specified number of pixels&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;resizeTo()&lt;/td&gt;
&lt;td&gt;Resizes the window to a specified width and height&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;scrollBy()&lt;/td&gt;
&lt;td&gt;Scrolls the document by a specified number of pixels&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;scrollTo()&lt;/td&gt;
&lt;td&gt;Scrolls the document to specified coordinates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setInterval()&lt;/td&gt;
&lt;td&gt;Calls a function or evaluates an expression at specified intervals&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;setTimeout()&lt;/td&gt;
&lt;td&gt;Calls a function or evaluates an expression after a specified interval&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;stop()&lt;/td&gt;
&lt;td&gt;Stops the window from loading&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Screen Properties&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Properties&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;availHeight&lt;/td&gt;
&lt;td&gt;Returns the height of the screen (excluding the Windows Taskbar)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;availWidth&lt;/td&gt;
&lt;td&gt;Returns the width of the screen (excluding the Windows Taskbar)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;colorDepth&lt;/td&gt;
&lt;td&gt;Returns the bit depth of the color palette for displaying images&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;height&lt;/td&gt;
&lt;td&gt;The total height of the screen&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pixelDepth&lt;/td&gt;
&lt;td&gt;The color resolution of the screen in bits per pixel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;width&lt;/td&gt;
&lt;td&gt;The total width of the screen&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>tutorial</category>
      <category>discuss</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>🔗PythonMysql_Connection</title>
      <dc:creator>Prajwal k</dc:creator>
      <pubDate>Tue, 07 Jun 2022 16:55:31 +0000</pubDate>
      <link>https://dev.to/prajwal056/pythonmysqlconnection-1441</link>
      <guid>https://dev.to/prajwal056/pythonmysqlconnection-1441</guid>
      <description>&lt;h1&gt;
  
  
  MysqlPythonConnection
&lt;/h1&gt;

&lt;h3&gt;
  
  
  About The Project
&lt;/h3&gt;

&lt;p&gt;MySQL Connector Python is used to access MySQL databases from Python using this repo. &lt;br&gt;
Student databases will be utilized in this project.&lt;/p&gt;
&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;p&gt;main.py program will be able to&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Insert Book&lt;/li&gt;
&lt;li&gt;Insert Student&lt;/li&gt;
&lt;li&gt;Insert Borrowing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Step 1 : Run studentDb.sql file in command prompt.&lt;br&gt;
&lt;a href="https://github.com/Prajwal056/MysqlPythonConnection"&gt;studentDb.sql&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to Run MySQL
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Give the path of .sql file as:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  mysql&amp;gt; &lt;span class="nb"&gt;source&lt;/span&gt; &amp;lt;sql Path.sql&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TEvWmleQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/39gyjkkjy5nsbsrp8j43.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TEvWmleQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/39gyjkkjy5nsbsrp8j43.jpg" alt="Image description" width="880" height="609"&gt;&lt;/a&gt;&lt;br&gt;
Step 2: Run main.py file&lt;br&gt;
main.py&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;from secrets import choice
from tkinter import W
import mysql.connector as c &lt;span class="c"&gt;# import the mysql connector&lt;/span&gt;
con &lt;span class="o"&gt;=&lt;/span&gt; c.connect&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"localhost"&lt;/span&gt;, &lt;span class="nv"&gt;user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"root"&lt;/span&gt;, &lt;span class="nv"&gt;password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"root"&lt;/span&gt;, &lt;span class="nv"&gt;database&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"studentdatabase"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="c"&gt;# connect to the database&lt;/span&gt;

print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'*'&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;50&lt;span class="o"&gt;)&lt;/span&gt;
print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Welcome to the Student Database"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'*'&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;50&lt;span class="o"&gt;)&lt;/span&gt;

cursor &lt;span class="o"&gt;=&lt;/span&gt; con.cursor&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="c"&gt;# create a cursor&lt;/span&gt;
&lt;span class="k"&gt;while &lt;/span&gt;True:
    &lt;span class="nv"&gt;choice&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; int&lt;span class="o"&gt;(&lt;/span&gt;input&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"1-&amp;gt; Insert Book&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;2-&amp;gt; Insert Student&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;3-&amp;gt; insert Borrowing&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;4-&amp;gt; Exit&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt; Your Choice: "&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;choice &lt;span class="o"&gt;==&lt;/span&gt; 1:
        book_name &lt;span class="o"&gt;=&lt;/span&gt; input&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Enter the book name: "&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        author &lt;span class="o"&gt;=&lt;/span&gt; input&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Enter the author name: "&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        isbn &lt;span class="o"&gt;=&lt;/span&gt; input&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Enter the isbn number: "&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        query &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"INSERT INTO books (book_name, author_name, isbn_number) VALUES (%s, %s, %s)"&lt;/span&gt;
        values &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;book_name, author, isbn&lt;span class="o"&gt;)&lt;/span&gt;
        cursor &lt;span class="o"&gt;=&lt;/span&gt; con.cursor&lt;span class="o"&gt;()&lt;/span&gt;
        cursor.execute&lt;span class="o"&gt;(&lt;/span&gt;query, values&lt;span class="o"&gt;)&lt;/span&gt;
        con.commit&lt;span class="o"&gt;()&lt;/span&gt;
        print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Book inserted successfully"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif &lt;/span&gt;choice &lt;span class="o"&gt;==&lt;/span&gt; 2:
        name &lt;span class="o"&gt;=&lt;/span&gt; input&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Enter the name: "&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        roll &lt;span class="o"&gt;=&lt;/span&gt; input&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Enter the roll number: "&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        query &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"INSERT INTO students (student_name, roll_number) VALUES (%s, %s)"&lt;/span&gt;
        values &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;name, roll&lt;span class="o"&gt;)&lt;/span&gt;
        cursor &lt;span class="o"&gt;=&lt;/span&gt; con.cursor&lt;span class="o"&gt;()&lt;/span&gt;
        cursor.execute&lt;span class="o"&gt;(&lt;/span&gt;query, values&lt;span class="o"&gt;)&lt;/span&gt;
        con.commit&lt;span class="o"&gt;()&lt;/span&gt;
        print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Student inserted successfully"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif &lt;/span&gt;choice &lt;span class="o"&gt;==&lt;/span&gt; 3:
        roll &lt;span class="o"&gt;=&lt;/span&gt; input&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Enter the roll number: "&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        book_name &lt;span class="o"&gt;=&lt;/span&gt; input&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Enter the book name: "&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        query &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"INSERT INTO borrowings (roll_number, book_name) VALUES (%s, %s)"&lt;/span&gt;
        values &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;roll, book_name&lt;span class="o"&gt;)&lt;/span&gt;
        cursor &lt;span class="o"&gt;=&lt;/span&gt; con.cursor&lt;span class="o"&gt;()&lt;/span&gt;
        cursor.execute&lt;span class="o"&gt;(&lt;/span&gt;query, values&lt;span class="o"&gt;)&lt;/span&gt;
        con.commit&lt;span class="o"&gt;()&lt;/span&gt;
        print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Borrowing inserted successfully"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif &lt;/span&gt;choice &lt;span class="o"&gt;==&lt;/span&gt; 4:
        &lt;span class="nb"&gt;break
    &lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;:
        print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Invalid choice"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; 
cursor.close&lt;span class="o"&gt;()&lt;/span&gt;
con.close&lt;span class="o"&gt;()&lt;/span&gt;
print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Connection closed"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>python</category>
      <category>mysql</category>
    </item>
  </channel>
</rss>
