This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template></template> | |
| <script> | |
| import firebase from '../plugins/firebase'; | |
| export defautl { | |
| created() { | |
| const messaging = firebase.messaging(); | |
| messaging | |
| .requestPermission() | |
| .then(() => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template></template> | |
| <script> | |
| import firebase from '../plugins/firebase'; | |
| export defautl { | |
| created() { | |
| const messaging = firebase.messaging(); | |
| messaging | |
| .requestPermission() | |
| .then(() => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plugins: [ | |
| '~plugins/firebase' | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as firebase from 'firebase/app'; | |
| import 'firebase/messaging'; | |
| if (!firebase.apps.length) { | |
| firebase.initializeApp({ | |
| apiKey: '', | |
| projectId: '', | |
| messagingSenderId: '', | |
| appId: '' | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| importScripts('https://www.gstatic.com/firebasejs/7.17.1/firebase-app.js'); | |
| importScripts( | |
| 'https://www.gstatic.com/firebasejs/7.17.1/firebase-messaging.js' | |
| ); | |
| firebase.initializeApp({ | |
| apiKey: '', | |
| projectId: '', | |
| messagingSenderId: '', | |
| appId: '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const array = [ | |
| "zero", | |
| "one", | |
| "two", | |
| "three", | |
| "four", | |
| "five", | |
| "six", | |
| "seven", | |
| "eight", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function minimumDistances(a) { | |
| let min; | |
| const findOtherIndex = index => { | |
| for (let i = index + 1; i < a.length; i++) { | |
| if (a[i] === a[index]) { | |
| return i; | |
| } | |
| } | |
| return null; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function beautifulTriplets(d, arr) { | |
| let result = 0; | |
| for (let i = 0; i < arr.length; i++) { | |
| const numb1 = arr[i] - d; | |
| const numb2 = numb1 - d; | |
| if (arr.includes(numb1) && arr.includes(numb2)) { | |
| result += 1; | |
| } | |
| } | |
| return result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //[Hackerrank] Solution of Modified Kaprekar Numbers in JavaScript | |
| function kaprekarNumbers(p, q) { | |
| let result = []; | |
| for(let i = p; i <= q; i++) { | |
| const squareString = (i * i).toString(); | |
| const num1 = squareString.substring(0, squareString.length/2); | |
| const num2 = squareString.substring(squareString.length/2, squareString.length); | |
| if (Number(num1) + Number(num2) === i) { | |
| result = result.concat(i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Complete the encryption function below. | |
| function encryption(s) { | |
| const ceil = Math.ceil(Math.sqrt(s.length)); | |
| let temp = s; | |
| let array = []; | |
| while(temp) { | |
| array = array.concat(temp.substring(0, ceil)); | |
| temp = temp.substring(ceil) |
NewerOlder