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
| class Person { | |
| constructor(name) { | |
| this.name = name; | |
| } | |
| static realStaticMethod() { | |
| console.log('static method'); | |
| } | |
| } |
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 copy(obj) { | |
| var copy = Object.create(Object.getPrototypeOf(obj)); | |
| var propNames = Object.getOwnPropertyNames(obj); | |
| propNames.forEach(function (name) { | |
| var desc = Object.getOwnPropertyDescriptor(obj, name); | |
| Object.defineProperty(copy, name, desc); | |
| }); | |
| return copy; |
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
| let a = [1, 2, 3, 4, 5] | |
| for (let v of a) { | |
| if (v == 3) { | |
| a.splice(0, 2); // remove 2 element from index 0 | |
| a = undefined; // for..of will have arrayname =a => undefined assignment will not affect for..of | |
| } | |
| console.log(v); | |
| } | |
| console.log(a) // undefined |
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
| class Employee { | |
| constructor(name) { | |
| this._name = name; | |
| } | |
| doWork() { | |
| console.log(`${this._name} is working`); | |
| } | |
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
| /* | |
| * Copyright (C) 2006 The Android Open Source Project | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
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
| /** | |
| * Convenience method to create a MediaPlayer for a given resource id. | |
| * On success, {@link #prepare()} will already have been called and must not be called again. | |
| * <p>When done with the MediaPlayer, you should call {@link #release()}, | |
| * to free the resources. If not released, too many MediaPlayer instances will | |
| * result in an exception.</p> | |
| * | |
| * @param context the Context to use | |
| * @param resid the raw resource id (<var>R.raw.<something></var>) for | |
| * the resource to use as the datasource |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
| <item android:state_enabled="false" | |
| android:color="@color/flat_disabled_text"/> | |
| <item android:color="@color/flat_normal_text"/> | |
| </selector> |
NewerOlder