Some Programming basics you need to know – Part 01

HTTP Methods, HTTP Status Codes, Event in JavaScript, JavaScript Array Examples

01. HTTP Methods

  • GET – Request some data from a server
  • POST – Submits a new resources to a server
  • PUT – updates a resource on the server
  • DELETE – delete a resource on the server
  • PATCH – Updates a resource on the server partially
  • CONNECT – Establishes a tunnel to the serve
  • TRACE – Performs a message loop-back test to the target resource.
  • HEAD – Same as GET, but doesn’t request for a repository body
  • OPTIONS – Describes the communication options for the target resource

02. HTTP Status Codes

1XX Informational HTTP status codes

  • 100 – Continue
  • 101 – Switching Protocols
  • 102 – Processing

2XX Success HTTP status codes

  • 200 – OK
  • 201 – Created
  • 202 – Accepted
  • 203 – Non-authoritative Information
  • 204 – No Content
  • 205 – Reset Content
  • 206 – Partial Content
  • 207 – Multi-Status
  • 208 – Already Reported
  • 226 – IM Used


3XX Redirection HTTP status codes

  • 301 – Multiple Choices
  • 302 – Moved Permanently
  • 303 – Found
  • 304 – See other
  • 305 – Not Modified
  • 306 – Use Proxy
  • 307 – Temporary Redirect
  • 308 – Permanent Redirect


4XX Client Error HTTP status codes

  • 400 – Bad Request
  • 401 – Unauthorized
  • 402 – Payment Required
  • 403 – Forbidden
  • 404 – Not Found
  • 405 – Method Not Allowed
  • 406 – Not Acceptable
  • 407 – Proxy Authentication Required
  • 408 – Request Timeout
  • 409 – Conflict
  • 410 – Gone
  • 411 – Length Required
  • 412 – Precondition Failed
  • 413 – Payload Too Large
  • 414 – Request-URI Too Long
  • 415 – Unsupported Media Type
  • 416 – Requested Range Not Satisfiable
  • 417 – Expectation Failed
  • 418 – I am Teapot
  • 421 – Misdirected Request
  • 422 – Unprocessable Entity
  • 423 – Locked
  • 424 – Failed Dependency
  • 426 – Upgrade Required
  • 428 – Precondition Required
  • 429 – Too Many Requests
  • 431 – Request Header Fields too long
  • 444 – Connection Closed Without Response
  • 451 – Unavailable for Legal Reasons
  • 499 – Client Closed Request


5XX Server Error HTTP status codes

  • 500 – Internal Server Error
  • 501 – Not Implemented
  • 502 – Bad Gateway
  • 503 – Service Unavailable
  • 504 – Gateway Timeout
  • 505 – HTTP Version Not Supported
  • 506 – Variant Also Negotiates
  • 507 – Insufficient Storage
  • 508 – Loop Detected
  • 510 – Not Extended
  • 511 – Network Authentication Required
  • 599 – Network Connect Timeout Error


03. Events in JavaScript

  • Mouse – onClick, onContextmenu, ondblcick, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseover, onmouseout, onmouseup
  • Keyboard – onkeydown, onkeypress, onkeyup
  • Frame – onabort, onbeforeunload, onerror, onhashchange, onload, onpagehide, onpageshow, onresize
  • Drag – ondrag, ondragend, ondragenter, ondragleave, ondragover, ondrop
  • Clipboard – oncopy, oncut, onpaste
  • Media – onabort, onended, onerror, onpause, onplay, onplaying, onseeking, onratechange

04. JavaScript Array example 01

[ 1, 2, 3 ].reduce(( x , y ) => x * y )          //6
[ 1, 2, 3 ].length          //3
[ 1, 2, 3 ].every( x => x < 10 )          //true
[ 1, 2, 3 ].some( x => x < 2 )          //true


05. JavaScript Array example 02

[ ‘a’ , ‘b’ ].concat([‘c’])          //[‘a’ , ‘b’ , ‘c’]
[ ‘a’ , ‘b’ ].join([‘-‘])          //’a-b’
[ ‘a’ , ‘b’ , ‘c’ ].slice(1)          //[‘b’ , ‘c’ ]
[ ‘a’ , ‘b’ , ‘c’ ].indexOf(‘b’)          //1
[ ‘a’ , ‘b’ , ‘c’ ].lastIndexOf(‘b’)          //2
[ 1 , 2 , 3 ].map( x => x * 2 )          //[2, 4, 6 ]
[ 2, 15 , 3 ].sort()          //15, 2, 3 ]
[ 1 , 2 , 3 ].reverse()          //[3 , 2, 1 ]

Thank you for reading. If you are interesting on my article, make sure to follow my other articles as well.