How does this javascript factorial function work?

Factory Function

When a function returns an object, we call it a factory function. It can produce object instance without new keywords or classes.

Ex:-

Factory Function with Parameter

Ex:-

Tagged : / / /

Accessing Properties in JavaScript

Accessing Properties

A property of an object is some piece of named data it contains. These are accessed with dot
operator applied to an object alternative to the dot operator is the array [ ] operator.

Syntax: – object_name.property_name

Ex:-

Accessing Properties

Accessing Methods

Object members that are functions are called methods. These are accessed with dot operator applied
to an object alternative to the dot, the operator is the array [ ] operator.

Syntax: – object_name.Method_name( );

Ex:-

Adding Properties/Methods

Syntax:-
Object_name.Property_name = value;
Object_name[„Property_name‟] = value;

Deleting Properties

Delete operator is used to delete instance properties.

Syntax:- delete object_name.property_name
Ex: – delete fees.Rahul

After removal with delete operator, the property has the undefined value.

Tagged : / / / /

HTML: Definition List

A definition list is a list of terms, with a definition of each term.

We can create definition list by using the <dl> ………. </dl> with <dt> and <dd> tag.

The <dt> …….. </dt> tag is used to define the term; whrereas, the <dd> tag is used to give the term’s definition.

<dl>
	<dt>College</dt>
	<dd>A boring place</dd>
	<dt>School</dt>
	<dd>Learn as much as you can</dd>
	<dt>University</dt>
	<dd>for fun</dd>
</dl>
Tagged : / / / / / / /

HTML: Ordered List

An ordered list displays a list of items using numbers or letters in either ascending or descending order.

The <ol> ………. </ol> tag is used to define an ordered list ; whereas the <li> ….. </li> tag is used to define the items of list.

Ex:-

<ol>
	<li>Linux</li>
	<li>Windows</li>
	<li>Mac</li>
	<li>Android</li>
</ol>
AttributeValue
Type1, A, a, I, i
StartAny numeric value
ReversedReversed
<ol type=1>
	<li>Linux</li>
	<li>Windows</li>
	<li>Mac</li>
	<li>Android</li>
</ol>
Tagged : / / / / / /

HTML: Unordered List

An unordered list is used to create a bulleted list of items.

The <ul> …………….. </ul> tag is used to define an unordered list; whereas, the <li> ……… </li> tag is used to define the items of the list.

Ex:-

<ul>
	<li>Linux</li>
	<li>Windows</li>
	<li>Mac</li>
	<li>Android</li>
</ul>
  • Linux
  • Windows
  • Mac
  • Android
Tagged : / / / / / /