JavaScript : Advantages and disadvantages of External JavaScript ?

Advantages :

Following are the Advantages of javaScript over external :-

  • Reusability of code.
  • Easy code readability.
  • It Enables both web designers and coders to work with html and js files.
  • With these small js files, you can use Google closure or YUI Compressor or other minifying tools to reduce the size and make it not readable by humans .

Disadvantages :

Following are the disadvantages of javaScript over external :-

  • Code can be downloaded using the url of the js file. This can help coders to steal your code easily.
  • If two js files are dependent on one another, then a failure in one file may affect the execution of the other dependent file.
  • A small change to a common js file may cause unexpected results in some of the HTML files .
  • The browser has to make an extra http request to get the js code.
Tagged : / / / / / /

JavaScript : Where to use javaScript code

JavaScript code use in following :

  1. Between the body tag of html
  2. Between the head tag of html
  3. In .js file (external javaScript)

1. JavaScript use between html body tag :

Example of javaScript using inside html between body tag.

Output :- Hello World

2. JavaScript use between head tag in html :

Example to use javaScript between head tag in html.

Output :

3. External JavaScript file :

We can create external JavaScript file and embed it in many html page. If you want to run the same JavaScript on several pages in a web site, you should create an external JavaScript file, instead of writing the same script over and over again.

message.js

index.html

Tagged : / / / / / / / / / / /

JavaScript : Introduction

JavaScript :

  • JavaScript is used to create client-side dynamic pages.
  • JavaScript (js) is a light-weight object-oriented programming language.
  • JavaScript is not a compiled language, but it is a translated language.
  • The JavaScript Translator (embedded in the browser) is responsible for translating the JavaScript code for the web browser.
  •  JavaScript, users can build modern web applications to interact directly without reloading the page every time.
  • databases such as CouchDB and MongoDB uses JavaScript as their scripting and query language.

Features of JavaScript :

There are following features of js :-

  • Object-Centered Script Language
  • Light Weight and delicate
  • Interpreted language
  • Case Sensitive format/language
  • Ability to perform In Built Function
  • Statements Looping
  • Client edge Technology
  • Validation of User’s Input
  • Else and If Statement
  • It uses prototypes rather than using classes for inheritance.
  • It is supportable in several operating systems including, Windows, macOS, etc.
  • It provides good control to the users over the web browsers.

Application of JavaScript

JavaScript is used to create interactive websites. It is mainly used for:

  • Client-side validation
  • Manipulating HTML Pages
  • User Notifications
  • Dynamic drop-down menus
  • Displaying date and time
  • Displaying pop-up windows 
  • Alert dialog box
  • Confirm dialog box
  • Prompt dialog box
  • Back-end Data Loading
  • Presentations
  • Server Applications
  • Displaying clocks etc.

JavaScript Example :

Output :-

Welcome to JavaScript

Hello JavaScript by JavaScript

Tagged : / / / / / / / / / / / / / /

Bootstrap : Default Text Sizes

Bootstrap’s font sizes are calculated off of the body font size by using rem values. If you change
the body font size all styles will be increased/decreased automatically. Rem stands for “root em”
because it calculates the size based on the size of the root of the document or body tag.

Tag / ClassDefault Font size
body16px; line-height: 1.5;
font-family: “Helvetica Neue”, Helvetica, Arial,
sans-serif;
p, li1rem / 16px
h12.5rem / 40px
h1 small80% / 32px
h22rem / 32px
h2 small80% / 25.6px
h31.75rem / 28px
h3 small80% / 22.4px
h41.5rem / 24px
h4 small80% / 24px
h51.25rem / 20px
h5 small80% / 16px
h61rem / 16px
h6 small80% / 12.8px
.display-16rem / 90px
.display-25.5rem / 82.5px
.display-34.5rem / 67.5px
.display-43.5rem / 52.5px
Tagged : / / / / / / / / / / / / /

Bootstrap Utilities : “Visibility”

With visibility utilities you have control the visibility, without modifying the display, of elements.

Tagged : / / / / / / / / / / / / / / / /

Bootstrap utilities : “Vertical align”

Easily change the vertical alignment of inline, inline-block, inline-table, and table cell elements.

Change the alignment of elements with the vertical-alignment utilities.

These are the classes:- .align-baseline, .align-top.align-middle.align-bottom.align-text-bottom, and .align-text-top as needed.

Tagged : / / / / / / / / / / / / / / / / /

Bootstrap Utilities : Text

Text Utilities classes, contains various text properties, such as, text alignment, text wrapping, text overflow, text transformation, font weight, italics, monospace, resetting color of text, removing text decorations.

1. Text alignment :

  • .class text-justify
  • .class text-left
  • .class text-center
  • .class text-right
  • .class text-sm|md|lg|xl-left

2. Text wrapping and overflow :

  • .class text-wrap
  • .class text-nowrap
  • .class text-truncate

3. Word break :

  • .class text-break

4. Text transform :

  • .class text-lowercase
  • .class text-uppercase
  • .class text-capitalize

5. Font weight and italics :

  • .class font-weight-bold
  • .class font-weight-bolder
  • .class font-weight-normal
  • .class font-weight-light
  • .class font-weight-lighter
  • .class font-italic

6. Monospace :

  • .class text-monospace

7. Reset color :

  • .class text-muted

8. Text decoration

  • .class text-decoration-none
Tagged : / / / / / / / / / / / / /

Bootstrap Utilities : Spacing

Spacing helpers are useful for modifying the padding and margin of an element.

Where property is one of:

  1. msets margin
  2. p-sets padding

Sides is one of:-

  • t-sets margin-padding “top
  • b-sets margin-padding “bottom
  • l-sets margin-padding “left
  • r-sets margin-padding “right
  • x-sets padding left|right or margin left|right
  • y-sets padding top|bottom or margin top|bottom
  • blank-sets margin padding on all sides of the element

Size is one of:-

  • 0-sets m|p to 0
  • 1-sets m|p to .25rem
  • 2-sets m|p to .5rem
  • 3-sets m|p to 1rem
  • 4-sets m|p to 1.5rem
  • 5-sets m|p to 3rem
  • auto-sets margin to auto

Negative margin :-

  • n1-sets margin to -.25rem
  • n2-sets margin to -.5rem
  • n3-sets margin to -1rem
  • n4-sets margin to -1.5rem
  • n5-sets margin to -3rem
Tagged : / / / / / / / / / / / / / / /

Bootstrap Utilities : “Screenreaders”

.sr-only class is used to hide an element in all device except screenreader.

Tagged : / / / / / / / / / / / /

Bootstrap Utilities : “Shadows”

box-shadow utilities class is use to add or remove shadows in the elements.

<div class="shadow-sm p-3 mb-5 bg-white rounded">Small shadow</div>
Tagged : / / / / / / / / /