Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //delete question
- delQuest = ()=>{
- this.nameOfQuest = this.getName(questionList.questions, this.randQuest);
- delete questionList.questions[this.nameOfQuest];
- let validate = Object.keys(questionList.questions).length;
- if(validate===0){
- alert('molca dlo');
- }
- }
- //get name of value
- getName = (obj, value)=>{
- value = JSON.stringify(value);
- return Object.keys(obj).find(key => JSON.stringify(obj[key]) === value);
- }
- //random property from object
- randomProp = (obj)=>{
- let keys = Object.keys(obj)
- return obj[keys[keys.length * Math.random() << 0]]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement