What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-25 13:02:02
for of vs for in javascript
let list = [4, 5, 6]; for (let i in list) { console.log(i); // "0", "1", "2", } for (let i of list) { console.log(i); // "4", "5", "6" } // EXAMPLE 2 let pets = new Set(["Cat",... Add solution -
Javascript 2021-09-25 12:42:07
custom hook for unique items in react
// useUnique.js export function useUnique(initial) { const [items, setItems] = useState(initial); const add = newItem => { const uniqueItems = [...new Set([...items, newItem])]; setItems(uniqueItems); }; return [items, add]; }; Add solution -
Javascript 2021-09-24 02:39:02
js data types
/* The latest ECMAScript standard defines nine types: Six Data Types that are primitives, checked by typeof operator: undefined : typeof instance === "undefined" Boolean : typeof instance === "boolean" Number : typeof instance === &qu... Add solution -
Other 2021-09-23 23:31:03
Write a trigger on contact to prevent duplicate records based on Contact Email & Contact Phone.
trigger PreventDuplicateContacts on Contact (before insert) { // Set to store email ids Set <String> emailSet = new Set<String>(); // Set to store phone numbers Set <String> phoneSet = new Set<String>(); ... Add solution -
Other 2021-09-17 06:22:02
child to parent and grandparent soql salesforce
public class Utility { // To get all sub roles. public static Set<ID> getAllSubRoleIds(Set<ID> roleIds) { Set<ID> currentRoleIds = new Set<ID>(); // get all of the roles underneath the passed roles ... Add solution -
Javascript 2021-09-14 16:09:02
set method in javascript
const myArray = [1,2,3,1,5,8,1,2,9,4]; const unique = [...new Set(myArray)]; // [1, 2, 3, 5, 8, 9, 4] const myString = ["a","b","c","a","d","b"]; const uniqueString = [...new Set(myString)]; //[... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5