---
title: Size of the Set
---
## Size of the Set
 Remember to use **`Read-Search-Ask`** if you get stuck. Try to pair program  and write your own code 
###  Problem Explanation:
To solve this problem, you have to write a function for the class that returns the size of the set.
##  Hint: 1
Create a size function in the Set class.
> _try to solve the problem now_
##  Hint: 2
Use the length attribute on the values of the Set.
> _try to solve the problem now_
## Spoiler Alert!

**Solution ahead!**
##  Basic Code Solution:
this.size = function()
{
return this.values().length;
}
 Run Code
### Code Explanation:
* The number of items is achieved by attaining the collection using the "values" function and getting the length attribute of it.
##  NOTES FOR CONTRIBUTIONS:
*  **DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution.
* Add an explanation of your solution.
* Categorize the solution in one of the following categories — **Basic**, **Intermediate** and **Advanced**. 