Friday, September 19, 2025
HomeLanguagesJavascriptCollect.js dd() Method

Collect.js dd() Method

The dd() method in collect.js is used to log the output of the function and stop the further execution thus exiting the current process.

Installation:

  • Using NPM:
    npm install collect.js
  • Using CDN of collect.js
    <script src="https://cdnjs.com/libraries/collect.js"></script>

Syntax:

collect.dd()

Parameters: It does not accept any parameters.

Return Value: It does not return anything.

Example 1:

Javascript




// Importing the collect.js module.
const collect = require('collect.js'); 
let array = [1, 2, 3, 4, 5, 6];
  
// Making the collection
let collection = collect(array);
  
// Using dd() function
collection.dd();


Output:

Example 2: Code after dd() function will not be executed.

Javascript




// Importing the collect.js module.
const collect = require('collect.js'); 
let array = ["a", "b", "c"];
  
// Making the collection
let collection = collect(array);
console.log("Output is: ");
  
// Using dd() function
collection.dd();
  
// This will not be printed on the console
console.log("neveropen for neveropen");


Output:

Reference: https://collect.js.org/api/dd.html

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32301 POSTS0 COMMENTS
Milvus
84 POSTS0 COMMENTS
Nango Kala
6666 POSTS0 COMMENTS
Nicole Veronica
11840 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11898 POSTS0 COMMENTS
Shaida Kate Naidoo
6781 POSTS0 COMMENTS
Ted Musemwa
7056 POSTS0 COMMENTS
Thapelo Manthata
6739 POSTS0 COMMENTS
Umr Jansen
6744 POSTS0 COMMENTS