Hello Friends, in this video I will teach you how to create crud application with local storage, JavaScript CRUD, Local storage JavaScript, JavaScript database tutorial, JavaScript web app development, JavaScript local storage tutorial, CRUD operations in JavaScript, Building a CRUD app with JavaScript, JavaScript offline application, JavaScript client-side storage, JavaScript application with local database
2 notes
·
View notes
How To Code In Javascript For Super Mario Brothers By Nathan Eric
Please Do Not Sue Me In Court For Copyright Infringement Claiming Issues Nintendo I Want To Teach Video Games They Are Becoming Over-Powered In Today’s Society Since The Year of 2018 A.D.
Step One = Draw A Single Ground Tile of 20 by 20
Step Two = Draw The Background of 200 X by 100 Y And Paint It Blue (0 red, 0 green, 200 Blue)
Step Three = Apply The Single 20 W By 20 H Ground Tile To The Blue Background
Step Four = Duplicate The 20 by 20 Ground Tile By 200 X and 100 for Y
Step Five = Add The Platforms By for Each Ground Tile X = 2, Random Roll a 0 To 20 for the Y Axis
Step Six = Add The Power Ups And Coinage = I.E. Draw a Yellow Coin On The Play Field And If Mario X and Y = Yellow Coin X and Y Then Add One To Score And If Score Is One Hundred add one life To Mario
Step Seven = Add The Enemy A.I. = I.E. Draw An Enemy Goombah and if Mario Y Position = Just Above The Goombah Y Position, Destroy The Goombah And Add Five Coins To Mario Score
Step Eight = Lastly Add Mario Himself Running In One State At a Time out of Fifteen Possible States
0 notes
10 JavaScript Tricks Every Developer Should Know
JavaScript is a tremendously powerful language, yet understanding its behavior can be difficult. Today I'll show you several JavaScript tricks for optimizing your JavaScript code. It will also assist you in writing clean code and optimizing your programming time.
Use these JavaScript tricks to optimize your JavaScript code.
1. Resize or Empty an Array Using array.length
When we wish to resize an array, we basically overwrite its length:
let array = ;
console.log(array.length); // returns the length as 10
array.length = 4;
console.log(array.length); // returns the length as 4
console.log(array); // returns
2. Flatten the multidimensional array
Using the spread operator, we may flatten a multidimensional array.
var entries = , , 9];
var flat_entries = .concat(...entries);
//
3. Getting the last item in the array
Using a negative number as the parameter allows us to retrieve the last piece from the array, which is another clever JavaScript tricks.
var array = ;
console.log(array.slice(-1)); //
console.log(array.slice(-2)); //
console.log(array.slice(-3)); //
4. Swap two variables without the third variable
Using the third variable, we can easily swap two variables. However, adding a variable requires adding memory. Additionally, memory can be optimized with just two variables.
let x = 1;
let y = 2;
= ; // x = 2, y = 1
5. Merging two arrays by optimizing memory
Using the array.concat() function, we can simply combine two arrays if necessary.
var array1 = ;
var array2 = ;
console.log(array1.concat(array2)); // ;
The best option for tiny arrays is this. However, if we need to merge big arrays, this strategy is completely inadequate. Why so? The array is the cause. concat() function on large arrays will consume a lot of memory while creating the new merged array.
There is no need for additional memory in this situation because we can use the array.push.apply(array1, array2) function to merge the second array into the first one. By doing this, we may use less memory.
var array1 = ;
var array2 = ;
console.log(array1.push.apply(array1, array2)); // ;
6. Instead of plain delete use splice
This could be the most effective JavaScript trick for simplifying JavaScript code. It also accelerates your code. Why shouldn't we use delete? Because it only deletes the object property and does not reindex or update the length of the array, leaving undefined values. Basically, it takes a very long time to execute.
Splicing rather than deleting is a smart technique because it removes some null/undefined space from your code.
Array =
Array.splice(0, 2)
Result: myArray
7. We should use a switch…case instead of if/else
The switch…case is always overlooked. The switch…case and if/else statements accomplish nearly identical tasks, however the switch…case statement executes faster than the if/else statement! Why is this the case? The if/else statement compares on average to get to the proper clause, but the switch statement is essentially a lookup table with known options.
8. Break the loop as soon as possible
Look for situations in which it is not necessary to complete every iteration of a loop. For example, if we are looking for a specific value and find it, future rounds are superfluous. As a result, we need use a break statement to end the loop's execution:
9. Reduce the chance of memory leaks
JavaScript relies heavily on memory management. If you do not correctly manage memory, memory will leak and cause your software to crash. A memory leak can occur for a variety of reasons. Some of the reasons are: unintentionally using global variables, forgetting about timers or callbacks, unneeded cache, and so on.
10. Understanding Big O notation
This is a fundamental yet underappreciated topic. If you master the Big O notation, you will quickly understand why some of your functions run faster and others use less memory. So, before getting into frameworks and other advanced topics, master this essential concept.
Thank you for your time. If you found this helpful, don't forget to share your JavaScript tricks with us.
Read the full article
0 notes
Custom Accordion written in Html, CSS and JavaScript. Link below
#html #css #javascript #bydev24 #accordion #cssaccordion #customdesign #webdesign #uidesign #uxdesign #htmlcode #csscode #javascriptcode #codesnippets #bydev24snipp #freecode
0 notes
لماذا يتم تضمين "use strict" في كود جافاسكربت؟
لفترة طويلة ، تطورت JavaScript دون مشاكل التوافق. تمت إضافة ميزات جديدة إلى اللغة بينما لم تتغير الوظائف القديمة. ولكن الجانب السلبي هو أن أي خطأ أو قرار غير كامل يؤدي إلى توقف بالكامل. كان هذا هو الحال حتى عام 2009 عندما ظهرت ECMAScript 5 (ES5). أضاف ميزات جديدة إلى اللغة وقام بتعديل بعض الميزات الموجودة. للحفاظ على عمل الكود القديم ، يتم إيقاف تشغيل معظم هذه التعديلات افتراضيًا. و تحتاج إلى تمكينها صراحةً بتوجيه خاص: "use strict".
فوائد "use strict"
إلتقاط الأخطاء الشائعة و الأخطاء الصامتة.
لا تسمح بالمتغيرات العامة Global Variables في حالة عدم وجود الكلمة المفتاحية var امام أي متغير فأنها تعتبر خطأ.
منع حذف الخصائص او Properties الغير قابلة للحذف
بالمختصر المفيد "use strict" تساعدك في كتابة كود جافاسكربت آمن و خال من الأخطاء.
1 note
·
View note
JavaScript Code Samples
Are you preparing for interview or to learn some code samples in javascript in native and non native methods. This is for you, the JavaScript code snippets of the all topics.
https://play.google.com/store/apps/details?id=com.vigowebs.jscodesamples
1 note
·
View note