What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-10 15:18:03
angular 12 service for create update delete local storage items
import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class LocalStorageService { localStorage: Storage; changes$ = new Subject(); constructor() { this.localStorage = window.lo... Add solution -
Javascript 2021-09-10 12:40:03
casl react
import { AbilityBuilder } from '@casl/ability'; import React, { useState, useContext } from 'react'; import { AbilityContext } from './Can'; function updateAbility(ability, user) { const { can, rules } = new AbilityBuilder(); if (user.role === 'admi... Add solution -
Javascript 2021-09-10 04:05:02
node js store add values in file
var fs = require('fs'); var myOptions = { name: 'Avian', dessert: 'cake' flavor: 'chocolate', beverage: 'coffee' }; var data = JSON.stringify(myOptions); fs.writeFile('./config.json', data, function (err) { if (err) { console.log('There h... Add solution -
Javascript 2021-09-09 11:55:01
javascript Compare two arrays regardless of order
// To compare arrays (or any other object): // Simple Array Example: const array1 = ['potato', 'banana', 'soup'] const array2 = ['potato', 'orange', 'soup'] array1 === array2; // Returns false due to referential equality JSON.stringify(array1) === JSON.s... Add solution -
Javascript 2021-09-09 10:34:02
how to setItem and getItem in javascript in localStorage
function set(){ var sendJSON = JSON.stringify(allMovie); localStorage.setItem('allMovie',sendJSON) } function get(){ var getJSON = localStorage.getItem('allMovie'); if (getJSON){ allMovie = JSON.parse(getJSON) } } Add solution -
Javascript 2021-09-08 20:21:02
get an access token for microsoft graph api using javascript
const postData = { client_id: APP_ID, scope: MS_GRAPH_SCOPE, client_secret: APP_SECERET, grant_type: 'client_credentials' }; axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; axios .post(TOKEN_ENDPOINT, qs.st... Add solution -
Javascript 2021-09-08 09:11:02
deep clone object javascript
JSON.parse(JSON.stringify(object)) Add solution