swysercoding-blog
swysercoding-blog
Swyser Coding...
71 posts
As a web developer you will walk a path that few have walked. The technologies that you implement and develop will define you as a person unique to the solution.
Don't wanna be here? Send us removal request.
swysercoding-blog · 8 years ago
Photo
Tumblr media Tumblr media
Mr. Robot.
391 notes · View notes
swysercoding-blog · 8 years ago
Video
youtube
What will you pick for 2017?
0 notes
swysercoding-blog · 8 years ago
Video
youtube
Definitely the best video about PWAs!
0 notes
swysercoding-blog · 8 years ago
Link
Definitely exiting stuff!! So they say it is like Angular 2, but with more cool stuff!
0 notes
swysercoding-blog · 9 years ago
Photo
Tumblr media
Everysoft Corporation by taires http://bit.ly/2fHDdcV
14 notes · View notes
swysercoding-blog · 9 years ago
Photo
Tumblr media
The Depressed Developer 2 by dstori http://bit.ly/2gfXMfz
9 notes · View notes
swysercoding-blog · 9 years ago
Photo
Tumblr media
👆🐶#programminghumor #programmerlife #funny #dog #badpundog
36 notes · View notes
swysercoding-blog · 9 years ago
Photo
Tumblr media
💻🙀#programminghumor #code #cat #programmingfun #cpp #dotnet
21 notes · View notes
swysercoding-blog · 9 years ago
Photo
Tumblr media
Now and Then, what it is to learn JS in 2016 by RolandCuley http://bit.ly/2gHdYoz
10 notes · View notes
swysercoding-blog · 9 years ago
Photo
So true...
Tumblr media
The 5 phases of software development by Gabr3l http://bit.ly/2fumyYA
13 notes · View notes
swysercoding-blog · 9 years ago
Link
Yup, it is now my new favourite hobby! Its a thing...
0 notes
swysercoding-blog · 9 years ago
Link
Great tool for checking different screen sizes and devices!
0 notes
swysercoding-blog · 9 years ago
Link
Soooo looking forward to this being released! Will make every Js coffee converter's life easier!
0 notes
swysercoding-blog · 9 years ago
Link
Ever wonder what the hell Webpack does? I know I did...so I found this awesome article that explains exactly what it does and how to use it!
0 notes
swysercoding-blog · 9 years ago
Link
Started playing around with Docker, I am so excited I even got VPS hosting!
0 notes
swysercoding-blog · 9 years ago
Text
Constants and Object.freeze in JavaScript
Node.js already supports const and most browsers eventaully will, but that only creates immutable variables not objects. For example:
const obj = { property1: 'value1' }; // some implementations will error out, some will just not assign to it. try { obj = { property2: 'value2' }; } catch (e) { console.log(obj); } console.log(obj); // { property1: 'value1' } obj.property1 = 'value2'; console.log(obj); // { property1: 'value2' }
This is where Object.freeze comes in, it prevents the entire object from being modified:
const obj = Object.freeze({ property1: 'value1' }); // some implementations will error out, some will just not assign to it. try { obj.property1 = 'value2'; } catch (e) {} console.log(obj); // { property1: 'value1' }
This is useful for the same reason that const is useful, it makes code more predictable by ensuring that an object’s properties and values can always be relied on once defined. Though it does have a weakness with arrays:
const arr = Object.freeze([{ property1: 'value1' }, { property2: 'value2' }]); // some implementations will error out, some will just not assign to it. try { arr[0] = { property2: 'value2' }; } catch (e) {} arr[0].property1 = 'value2'; console.log(arr);
So it is important to remember to use Object.freeze on each array element:
const arr2 = [{ property1: 'value1' }, { property2: 'value2' }].map(Object.freeze); // some implementations will error out, some will just not assign to it. try { arr2[0].property1 = 'value2'; } catch (e) {} console.log(arr2); // [ { property1: 'value1' }, { property2: 'value2' } ]
Although, this does not seem like something that has good support, it actually works in all modern browsers. Though since Object.freeze is most useful with const and const is still not supported in some environments, you will need another way of generating constants. Finally, frozen objects run just as fast as regular objects. Frozen objects only ran slower in the past due to browser bugs. For example: https://bugs.chromium.org/p/chromium/issues/detail?id=115960.
Github Location: https://github.com/Jacob-Friesen/obscurejs/blob/master/2016/objectFreeze.js
12 notes · View notes
swysercoding-blog · 9 years ago
Link
Material icons!
0 notes