Skip to content

Instantly share code, notes, and snippets.

View nikhilmufc7's full-sized avatar
🏠
Working from home

Nikhil Singh nikhilmufc7

🏠
Working from home
View GitHub Profile
function shouter(whatToShout) {
// your code here
}
/* From here down, you are not expected to
understand.... for now :)
Nothing to see here!
function isDivisible(divisee, divisor) {
return divisee % divisor === 0;
}
/* From here down, you are not expected to
understand.... for now :)
Nothing to see here!
function main() {
try {
doAllTheThings();
}
catch(e) {
console.error(e);
reportError(e);
}
}
function average(numbers) {
var total = numbers[0];
for (var i=1; i < numbers.length; i++){
total += numbers[i];
}
return total/numbers.length;
}
What is scope? Your explanation should include the idea of global vs. local scope.
A. Scope is the declaration and accesibility that is possible in javascript, i.e the local and global scope wherin the variables
get stored in a global way, that can accessed anywhere in the program or
a Local variables have ,They can only be accessed within the function.
Why are global variables avoided?
Global variables are avoided because it creates a fuss if we programming 1000s of lines of codes.
Explain JavaScript's strict mode?
Strick mode is a way of writing secure javascript. It helps us in avoiding globad variables. It will throw an error if the
function keyDeleter(obj) {
obj.delete='foo';
obj.delete='bar';
return obj;
}
var sampleObj = {
foo: 'foo',
bar: 'bar',
function mergeDataStreams(stream1, stream2) {
var results = {};
for (var i=0; i < stream1.length; i++) {
results[stream1[i].id] = stream1[i];
}
for (var key in results) {
var otherData = stream2.find(
function(item) { return item.id === key; });
for (var _key in otherData) {
@nikhilmufc7
nikhilmufc7 / auth.dart
Last active April 14, 2024 13:06
Firebase Flutter Platform Exception Codes and example
// Error Codes for SignUp
ERROR_OPERATION_NOT_ALLOWED` - Indicates that Anonymous accounts are not enabled.
ERROR_WEAK_PASSWORD - If the password is not strong enough.
ERROR_INVALID_EMAIL` - If the email address is malformed.
ERROR_EMAIL_ALREADY_IN_USE - If the email is already in use by a different account.
ERROR_INVALID_CREDENTIAL` - If the [email] address is malformed.
// sending password reset email
ERROR_INVALID_EMAIL` - If the [email] address is malformed.
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:io';
import 'package:flutter/services.dart';
import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:ielts/screens/home_screen.dart';
import 'package:ielts/utils/app_constants.dart';