Skip to main content

Web-Related Terms Beginning with F

Factory Function in JavaScript

A factory function is a regular function that uses the return keyword to produce a new object whenever you invoke it with a different argument.

In other words, a factory function serves as a template for producing new JavaScript objects.

Here's an example:

// Define a factor function:
function createName(name) {
return { name };
}

// Create an object from the createName() factory:
const bestWebsite = createName("CodeSweetly");

// Create another object from the createName() factory:
const author = createName("Oluwatobi");

// Create a third object from the createName() factory:
const sweetColor = createName("Pink");

// Check bestWebsite's content:
bestWebsite;

// The invocation above will return:
{
name: "CodeSweetly";
}

// Check author's content:
author;

// The invocation above will return:
{
name: "Oluwatobi";
}

// Check sweetColor's content:
sweetColor;

// The invocation above will return:
{
name: "Pink";
}

Try Editing It

The createName() function is a factory function because:

  1. It uses the return keyword to produce its object.
  2. It creates a new object whenever you invoke it with a different argument.
note

A factory function's returned object does not inherit the function's prototype.

Suppose you want your function's object to inherit the prototype property. In that case, use an object constructor to create the object.

Fake in Test-Driven Development

Fake is a test double used to create a working test implementation of an external dependency with dynamic values.

Learn more...

Falsy in JavaScript

Falsy values are values JavaScript considers to be false.

The seven falsy values in JavaScript are: 0 (zero), false, "" (empty string), NaN, null, undefined, and 0n (BigInt zero).

File Path (URL)

A URL's file path is the path (route) to a website's resource on a web server.

Learn more...

filter() in JavaScript

filter() creates a new array that contains all the calling array's elements that passed the test specified by the method's function argument.

Learn more...

Fisher-Yates Shuffle

Fisher-Yates shuffle is an algorithm for generating random arrangements of an array.

Learn more...

Flags (RegExp)

Flags are operators used to specify how you want the computer to interpret a regular expression pattern.

Learn more...

Floating Element in CSS

A floating element is one whose float property's value is not none.

Font

A font is a specific style used to alter a text's appearance.

Learn more...

for…in Loop Statement in JavaScript

A for...in loop instructs the computer to loop through each property in a given object.

Learn more...

for…of Loop Statement in JavaScript

A for...of loop instructs the computer to loop through each of an iterable object's values.

Learn more...

forEach() in JavaScript

The forEach() method executes its function argument once for each item of the calling array.

Learn more...

Fragmentation Properties in CSS

The CSS fragmentation properties specify how browsers should display fragmented (divided) content.

Learn more...

Framework

A framework is a codebase written to serve as the primary structure for your application.

Learn more...

Function Body

A function's body is where you place a sequence of statements you want to execute.

Learn more...

Function Component

A function component is a regular JavaScript function that can accept a single properties object (props) as its parameter and emits a React element as its return value.

Learn more...

Function Declaration in JavaScript

A function declaration is a function created without assigning it to a variable.

Learn more...

Function Definition in JavaScript

A function definition is a function created without assigning it to a variable.

Learn more...

Function Expression in JavaScript

A function expression is a function that you create and assign to a variable.

Learn more...

Function in JavaScript

A JavaScript function is an executable piece of code developers use to bundle a block of zero or more statements.

Learn more...

function Keyword in JavaScript

A function keyword declares to browsers that a specific piece of code is a JavaScript function—not a mathematical or other generic function.

Learn more...

Function Name

A function's name allows you to create an identifier for your function, which you can use to reference it.

Learn more...

Function Statement in JavaScript

A function statement is a function created without assigning it to a variable.

Learn more...

Function's Body in JavaScript

A function's body is where you place a sequence of statements that you want to execute.

Learn more...